View Full Version : [tute] Fighting Game!!
Dr Warm
November 30th, 2004, 09:03 AM
My second thread on kirupa! Thought it was about time for a new one!
I'd like everyone to get something from this tute, not just people making fighting games. Although this will not be aimed directly at people starting out using flash, I'm hoping that they will get something out of this.
I've tried to make my flas sort of OOP, being that it should be easily adjust for you're game, ie just change a few variables, animations and it should work out. But unfortunately every game is different (I hope!) so some things may need to be altered, but if you understand it all, it shouldn't
be a problem!
I'd like this to be a more community based tute, rather than making an 'official' one on the main site only because I'm constantly changing my mind etc, and I would probably ever get around to finishing it! At least here something will be done. I've noticed the trend of tutes on this forum is that they get half done then washed away in the sands of time.....(sorry!), like Marz's two tutes, no offence of course to Marz, I know you're very busy and have a life! But hopefully I'll be able to complete as much of my
objectives as possible.
Because I'm using sprites I've got from a game (Little Fighter 2) some files will be bigger than can fit on the kirupa forums, so I'll have to host on a different site, and because I only have free hostings it might not be too reliable, but should hopefully not be a problem. I mean all the flas will only be over the limit by a few kb, so it should be alright! I'm also going to base this on the game Little Fighter, only because I have it already and I think it's pretty cool, and has everything you need in a fighter like this.
*Rules*
I'd just like to have these so this thread won't turn out like the RPG thread, 7 pages of posts but only 1 (post not page!) with the tutorial! Feel free to post if you have a question about what I've done, or would like something explained clearer, but for any specific question with a game you're making,
please make a new thread and ask it there and i'll see if i can fix it. Also feel free to post any suggestions or other comments you have on here,I would like any feedback! And of course any bugs you can find, I'm a shocking speller!
I'm posting all files in MX format, just because I don't see any real benefit doing it in 04 format. And it will also increase the amount of people that can use this tute. I'd like it if everyone else contributing could do this as well.
*Plans for Future Releases*
I would like your input for these suggestions, they are sort of in the order they'll be added, unless I find that it's easier doing them a different way, anyway here they are:
- jumping
- scrolling (including limits, walls etc)
- combos
- items (baseball bats, crates etc)
- 2 Human Players (ie damage, health, game over)
- AI <-- if i can manage!!!!
Dr Warm
November 30th, 2004, 09:05 AM
This first fla isn't very exciting, just the basics, movement in four directions and punching plus they're animations.
Keys are: Arrow keys for movement and 'a' key for punching.
As you can see I haven't put in any limits yet, the guy can walk right off the stage in all directions. You will notice in the movie clip of the guy there's extra animations, but these aren't used yet, there's also alot more I haven't got around to adding yet, ie combos etc.
There's quite alot of code you'll notice (it says 264 but there's alot of comment lines) but it's all needed as the structure that the rest will be built onto. Most of the next flas won't have too much extra code, just new concepts etc.
I think the most important thing to note in this fla is getting the animations right, because that's what the users will notice. I've made it so that if you're walking or standing this will be overcome by the attack animation, I'll refer to this as a heirachy, think of it like a pyramid, ie walking etc on the bottom because that's more common, but as you get higher the things are less common, thus more important.
The other thing to note is to get the animation of the punch to only happen once, and the next time you press it if it's in the middle of the animation it won't go back to the start.
To do this (as you'll find in the fla) I've used key listeners to see when the 'a' key has been pressed, but not released, and given him the property of punching which is removed when the animation has finished. To remove it, in the characters timeline I have just put 'this.punching = false', allowing him to play movement animations again.
That's all for this time!
Thanks for reading, Dr Warm!
Dr Warm
December 4th, 2004, 03:01 AM
This part wasn't as hard as I expected. There are two sort of versions of jumping, there's standing still jumping and jumping across jumping. If you're holding a direction key (left or right) before the jump you'll move in that direction, but if you aren't holding a direciton key, then you'll just jump straight up and down. I've noticed in many platformers made by people starting in flash, you can jump in the air, then once in the air you can move across etc, this is unrealistic (seriously just try it), so I didn't allow it in my game.
Now I've noticed I haven't got any feedback on this thread (I know I'm observant aren't I!), just remember if you don't want to reply with a post for whatever reason, you can always rate this thread (it's at the top of the page), give me 1 star if you think I deserve it, I would just like to know
what people think.
Keys are: Same as pt 1, but 's' key for jumping.
*Changes*
- Changed some things that were in part 1, specifically using my 'keys' object where i forgot to last time, ie changed:
if (Key.getCode() == 65) { to
if (Key.getCode() == keys.punch) { and also:
if (Key.isDown(Key.RIGHT)) to
if (Key.isDown(keys.rght) etc the reason I do this (storing key values in variables) is not because it's quicker or anything, but so the user can set there ownn keys, if you decide to do it. Also if you decide to change which key you want to use for something, you will only need to change it once, not several times.
- After he finishes punching, set it so he will be able to walking instead of standing, I commented it in the characters timeline, in actions layer, just after the punching animation finishes
- Added lots more animations, though most aren't being used just yet, but hopefully it'll give you a taste of what's to come. There's still about 3 times the amount left for me to put in there!
- Removed the 'break' parts, after I realised that they don't do anything (in this case)!
- In the moveChar function changed it so that you can't move while punching, after playing little fighter a lot. But he does move forward a bit when punching, as happens in little fighter.
Alas the time has come, the zip file of this tute is 130kb (too large for me to post)! So you'll have to copy this address into you're browser and download the fla like that:
http://drwarm.freeserverhost.net/stuff/tute pt 2.1.zip
I can't link directly, because I think that's called 'hotlinking' or something, and they've stopped me from doing it! This host should be reliable, and I have 3GB of bandwidth, which should be okay, since the last part was downloaded less than 25 times :(.
There's not actually alot more code in this part, but i guess all he's doing is jumping!
Ok until next time...............later :cool:,
Dr Warm
aeriform
December 4th, 2004, 03:59 PM
Hey, this is HeyGod from the flashkit forums, you posted in my topic about the lack of sources for this type of stuff. This is SOOO helpful, this is awesome, and is much appreciated. Keep up the great work!
SeiferTim
December 5th, 2004, 01:50 AM
Hey Doc, if you need to, I can set up some space on my server for you. I'd hate to see a decent tutorial like this go to crap due to a problem with hosting. PM me, or e-mail me and let me know, and I'll set it up for you when I have some time. I love my Linux-Apache HTTP Server :pleased:
Dr Warm
December 5th, 2004, 08:01 AM
Sorry about this, there was just two small bugs. It'll be in the next version anyway, just thought I'd do it for now, incase you notice it as well.
1. After punching he was tracing "not walking" even when he was supposed to. This was due to a spelling error, but fixed it by making the "keys" object a 'global' variable, so it can be accessed through all timelines.
2. After jumping he wouldn't stop walking if you were holding across while in the air. Changed this so that keys are 'logged' (stored as variables) even while jumping and punching, he just won't play that frame.
You can dowload the new version at this address, and I changed it in the post above as well:
http://drwarm.freeserverhost.net/stuff/tute pt 2.zip
Thanks for replying you guys, means that I'm not doing this for just myself! I would like to take up that offer of hosting seiferTim, I sent you an email already.
*Next Release*
The next tute, I'll make the punching 'combo' and jumping 'combo' with rapid keypresses of those keys. Hopefully I'll guy this done before Wednesday, because I'm going for a holiday for 10 days after that!
Dr Warm
JoMan
December 5th, 2004, 09:52 AM
Nice tutorial Dr. Warm :thumb:. Can't wait tor those punching combos!
Dr Warm
December 7th, 2004, 07:50 AM
Sorry I'm not able to finish the punching combo, just been too busy. But I did do the 'double jump' part, though I haven't explained it as detailed as I would like......
Keys are: Same as pt 2.
The fla can be found here:
http://drwarm.freeserverhost.net/stuff/tute pt 3a.zip
To perform the double jump, in the first jump, after you've reached the peak of the jump (either the moving jump or not) and press a direction key and the jump button, and you'll (hopefully) be able to perform the double jump!
I needed to make a few more variables for the character, name the jump1 and jump2 ones. If you'll look in the fla you'll hopefully see how these are used and incorporated into the script.
I hoped to use a similar process to do the punch-combo, but it didn't work.
You won't see more tutes (or any sign of me) on the forums, for at least 10 days. I'm going on a 10 day holiday to Queensland Australia (it's really sunny there), should be fun!!
I should do the punch-combos when I get back!
Happy flashing,
Dr Warm!
Inferno
December 10th, 2004, 03:07 PM
darn.. can someone tell me how to use my own drawn animations on this game? :(
JoMan
December 10th, 2004, 04:30 PM
Well, -personaly- I draw everything on flash, but I will sometimes draw it on paper then import it into flash and modify it, but if you need help for animation, you should check out this place:
http://www.freetoon.com/
That's a good source for free animation tips and tricks.
P.S. The best way to animate something, is by drawing it on paper first.
peace
ozzy_fan666
December 13th, 2004, 10:35 PM
God! Thank you for that site!
JoMan
December 14th, 2004, 01:29 AM
No problem :).
jonz80
December 15th, 2004, 07:22 AM
I'd like to check out the flas but the links are'nt working. I made a couple fighting games myself and find the input controls to be the hardest feature to acomplish, so im super interested to see how you do it.
thanks,
Jona
chazzyman
December 15th, 2004, 01:48 PM
I've made a fighting game, its 2 player i was wondering how i would go about making it 1 player? so that you can fight a computer player (would you use a random function?)
Dr Warm
December 19th, 2004, 06:39 AM
Yay I've got some more responses!! I'm back from my holiday, it was wicked. Hopefully I'll get the next parts of my tutes done soon, though being without flash for 11 days, my brain has switched off!
I'd like to check out the flas but the links are'nt working.
You have to copy the link address and put it in a new browser window, it works for me!
I've made a fighting game, its 2 player i was wondering how i would go about making it 1 player? so that you can fight a computer player (would you use a random function?)
Yeah hopefully I'll get to this eventually, but since I can't tell you how to do it in one line, I'll say, make a new thread (because it depends on lots of things, like how you're game plays, is set up etc), look at Marz's AI tute (do a search), and then I'll help you out on you're thread.
darn.. can someone tell me how to use my own drawn animations on this game? Well you put them in the keyframe where I've got mine, I've set it up so there's an animation for walking, jumping, punching etc. Sorry if that doesn't answer you're question, it seems obvious to me!
I think that's everyones questions answered. Come back soon and I should have another exciting installment ready for you (I know i'm lame!)!
Until next time,
Dr Warm
Inferno
January 14th, 2005, 02:34 PM
i know that i need to patient, but i cant wait for next part :(
JoMan
January 14th, 2005, 02:39 PM
Well tutorial writing is an art (in my opinion), and DR Warm is probably working hard on this tutorial. Also, He could be busy, and not have time to finish/continue the tutorial. Take your time, Dr Warm :).
peace
mixedtrigeno
January 14th, 2005, 03:26 PM
joman u are a great teacher also and i do mean great why dont u give dr warm a hand on the tutorial
JoMan
January 14th, 2005, 11:28 PM
why dont u give dr warm a hand on the tutorial
Well, because I really don't have time at this point. Maybe when I find the time, I shall help out (if he needs it).
peace
kingofnukes
January 23rd, 2005, 06:39 PM
Thank you Dr. Warm, I've been looking for a tute like this for 2 days now.
I just hope you put Ai and enemys inthe new version. Oh, and what are all the controls for the game.
mixedtrigeno
March 1st, 2005, 05:07 AM
hey whatever happen to the next part of this tutorial?
Powered by vBulletin® Version 4.1.10 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.