We would love you to play this but your browser doesn't support HTML5 canvas.
Just use a different browser and you can happily play this game.

Fight Knight Game

Hail good Sir Knight!

Those buffoons from the neighbouring Kingdom have been scurrying about our land breaking our branches and bothering our butterflies. Wouldst thou perchance take on the battle of honour and rid the encampent of our enemy?

There shall be beauteous wenches and a feast waiting for you on the morrow should you succeed in your duty.

The swipes from your sword shall surely cause them to drop some secrets or information that you may gather and bring to us forthwith! Fare thee well!

Objective :

Use your sword to hit the other player

Controls :

W,A,S,D - Move
Double Tap W,A,S,D to Dash
Space to Swing Sword
The shield will not move around like the player but will only follow if you get too far away from it, use this to tactically move around the shield and attack the other player.

Info :

While this game may look simple it has very sophisticated mechanics behind it.

For example the sword animation is smart enough to know that if you hit the opponents sword or shield it can reset its position in a natural looking way without playing the rest of the animation or rewinding it.

Also the AI might look like it is being stupid sometimes but actually it is making some smart decisions from the state of the board, with just the perfect amount of randomness added in so it is always unpredictable.

And lets not forget the rather nifty collision detection that I am quite proud of but I just take for granted.

Code :

This is the code I use on the limbs to make them move and look like they are connected to each other. This one is for the upper left arm, this is actually the most complex because it can also stretch to the shoulder, but all of the others are really just clones of this. This is all written in GameMaker.

Step Event:

x = myplayer.myshieldarmbottom.x + lengthdir_x(22, 270+myplayer.myshieldarmbottom.image_angle);
y = myplayer.myshieldarmbottom.y + lengthdir_y(22, 270+myplayer.myshieldarmbottom.image_angle);

var sholderx = myplayer.x + lengthdir_x(35, 90+myplayer.rotation);
var sholdery = myplayer.y + lengthdir_y(35, 90+myplayer.rotation);

image_angle = point_direction(x,y,sholderx,sholdery)+90

image_yscale = point_distance(x,y,sholderx,sholdery)/25

This is the code I use to make the feet work out where they should be. I found it quite hard to predict where the feet would have to be, however this relatively simple solution looks like it works quite well and very efficiently. Some of the main problems were trying to make feet go to the location before they were needed, and also the problem that you can’t have both feet moving at the same time. Again all written in GameMaker

Step Event:

var restingx = myplayer.x + lengthdir_x(18, footrestingangle[footside]+myplayer.rotation);
var restingy = myplayer.y + lengthdir_y(18, footrestingangle[footside]+myplayer.rotation);

var distancebeforemoving = 18

if (point_distance(x,y,restingx,restingy) > distancebeforemoving) { // how far before moving
    otherfoot.speed = 0
    var directiontomove = point_direction(x,y,restingx,restingy)
    walktowardsx = myplayer.x + lengthdir_x(distancebeforemoving*2, directiontomove);
    walktowardsy = myplayer.y + lengthdir_y(distancebeforemoving*2, directiontomove);

if (point_distance(x,y,walktowardsx,walktowardsy) < distancebeforemoving) { // stop the feet moving 
    speed = 0

image_angle = myplayer.image_angle

If you wanted to use the screen effect I have in deathmatch where everything gets darker apart from a spotlight on the players and then it zooms in this is the code I used in GameMaker:

Function/Script: EaseInQuart(inputvalue,outputmin,outputmax,inputmax)
return argument2 * power(argument0 / argument3, 4) + argument1;

Create Event:

spr_hitoverlay = sprite_create_from_surface(application_surface, 0, 0, room_width, room_height, false, false, 0, 0);

Draw Event:

var zoom = EaseInQuart(frame,1,2,framecount)
var imageoffsetx = EaseInQuart(frame,1,x,framecount)
var imageoffsety = EaseInQuart(frame,1,y,framecount)

// Start drawing everything onto a surface and not the screen    
surf = surface_create(1024, 1024);


draw_set_blend_mode(bm_subtract) // remove anything we now draw from the image

// I already moved the object to be at the location that was the mean of 
//the hit location, the sword that did the attack and the player that got hit

draw_set_blend_mode( bm_normal ); //reset things

// Out put everything you put on the surfeace and reset it all

draw_surface(surf, 0, 0);

About the Game:
Play in your Browser!
By David Strachan and lotsalmp
Get an E-mail when I post something new: Signup