Page 1 of 1

Samureye - basic fighting engine

PostPosted: Thu Sep 25, 2008 10:34 pm
by DilloDude
Here's a basic fighting game I've made over the past week.
samureye.zip
(141.49 KiB) Downloaded 420 times

screenshot.png

Controls
A, D: run left and right.
S: crouch
spacebar: jump
numpad 8, 4, 5, 6: attack

The faster you run, the higher you jump. You also jump higher if you're crouching, so to get maximum height, run fast, then quickly crouch and press jump.
To wall-jump, run at a wall and jump. Press jump again in the air before you hit the wall to kick off it.

Attacking press the attack key in the direction you want to attack in. There are eight attacks:
On the ground:
  • 4/6 (in the direction you're facing): basic kick.
  • 4/6 (the other way): back punch.
  • 5: slide kick.
  • 8: uppercut punch.
In the air:
  • 4/6 (in the direction you're facing): fly kick (hold the key down and then release to attack).
  • 4/6 (th other way): double spin kick.
  • 5: dive kick.
  • 8: double flip kick.
Explanation
The player is made up of four actors:
  • The graphic (the part you see)
  • The actual player actor (purple)
  • A base to detect when you leave the ground (yellow)
  • An attack sensor to do the attacking (red)
The graphic is separate from the player for a few reasons
  • It's easier to have certain areas count as collisions, and others not (ie. If your player carries a sword, you don't want him do pe able to be killed when someone punches the sword)
  • It makes the player a better shape for collisions, so the shape stays the same, especially since in this case, the player is a stick-figure, so lots of things could easily miss him because he's so thin

Actors use the stats variable as a set of bits to know how to interract with each other:
  • bSolid: This is for solid things like walls
  • bAttack: This is for things that are attacks, or do damage; they use the variable 'dir' as the direction the object they should hit should fly, and 'strength' as the strength of the attack (for how fast to make things fly, how much damage to do, etc.)
  • bSide: The 'side' the attack is on (true = enemy, false = you). This is primarily for the making sure you can't hit yourself (you can go flying all over the shop if you disable this check, but once you add health it will get really bad).
  • bUseSide: whether to count bSide (ie. things like balls want to hurt both you and enemies. They have this value false. You have it true. An enemy would also have it true).
So an enemy would have a collision similar to sam_col->collision->any side of any actor (you can add health in yourself) but you'd change the condition
Code: Select all
if ((collide.stats & bAttack) && ((collide.stats & bSide) || (collide.stats & bCountSide) == 0))

to
Code: Select all
if ((collide.stats & bAttack) && (((collide.stats & bSide) == 0) || (collide.stats & bCountSide) == 0))

On his attacks creation, you'd set stats to
Code: Select all
stats = bAttack | bSide | bCountSide;

Conclusion
That's about it for now. At the moment, the game is simple: just run and jump around and have fun smashing balls everywhere.
Graphics were made using Pivot Stick-Figure Animatior and Graphics Gale. Sounds were made in your imagination :wink:
I don't really have any particular plans for future development of this game, so feel free to modify it, add stuff to it and improve it at your leisure (why not have a contest to see who can make the best game from it?) If you have any further questions about how it works, ask here.
That's all for now.

PS: I'm getting weird problems with the key-ups not always being received, especially when lots of them happen at once. Anyone else get this?

Re: Samureye - basic fighting engine

PostPosted: Thu Sep 25, 2008 11:17 pm
by pyrometal
Very well made Dillodude! It's a shame my laptop doesn't have a numpad though... couldn't test the attacks, sorry! I'm sure people will give you feed back about those though. I've used the method you described for spliting the player into parts for a long time now, and it does work very well indeed, but I've always limited myself to 2. I'm impressed! Keep up the excellent work, and keep showing off GE's potential! ttyl

--pyro

Re: Samureye - basic fighting engine

PostPosted: Fri Sep 26, 2008 12:49 am
by edh
Very cool. Reminds me of N or the Portal flash game.

Nicely done.

(The controls suck on my laptop, though. :) I have to hold the fn key to make the keys act like a number pad. gah!)

Re: Samureye - basic fighting engine

PostPosted: Fri Sep 26, 2008 12:59 am
by DilloDude
Yeah, I didn't really think about laptop keyboards...
But you can always edit it to change the keys if you want.

Re: Samureye - basic fighting engine

PostPosted: Fri Sep 26, 2008 2:24 am
by BlarghNRawr
edh wrote:Very cool. Reminds me of N or the Portal flash game.

yay N

Re: Samureye - basic fighting engine

PostPosted: Sat Sep 27, 2008 12:46 am
by smallville
VERY NICE! - i like the way the stick man slides when you stop! :lol: :D
good job! +1 from smallville

Re: Samureye - basic fighting engine

PostPosted: Sat Sep 27, 2008 8:43 am
by Lexcondran
wow thats awesome but dude one of the glitches os an issue i cant think of. when the balls hit me i started running nonstop forward and couldnt do anything :o

Re: Samureye - basic fighting engine

PostPosted: Sat Sep 27, 2008 10:06 am
by DilloDude
Yeah, I think that's a problem when a lot of keys are released at once, some keys stay on for some reason. When this happens, you can fix it by pressing the offending key and then releasing it again. I tried various methods to get around this problem but to no avail.

Re: Samureye - basic fighting engine

PostPosted: Sat Sep 27, 2008 11:02 am
by MrJolteon
For laptop users(like me) maybe you can use the numbers at the top(below f1 f2 f3 f4 f5 f6 f7 f8 f9 f10 f11 and f12(why do we really have those keys? Answer: They are key shortcuts(like f11 puts internet in fullscreen and f5 updates the site)))

Re: Samureye - basic fighting engine

PostPosted: Sun Sep 28, 2008 7:31 am
by Spidy
nice game keep it up