r/gamemaker • u/1magus • Jun 06 '14
Help! (GML) Attacking Animations Help [GML]
I'm currently using version 1.3.1344 and I have been trying to get this to work. Basically I want to have my object (and not my player, right now I'm having my weapon obj float in the air) have multiple combos. So attack once and if you attack again right afterwords then it plays out a new animation and same for the third time. If you attack again too late, then it simply starts over.
You can ignore the first four variables. Does anyone know what I'm doing wrong? I tried adding in release keyboard code but in the end that only changed the sprite when pressing the attack button and changed it back when releasing, it ignored the timers. You can also ignore which animations I picked, I was just going on random.
View all comments
Show parent comment
1
u/PixelatedPope Jun 06 '14
Well, I can give you a little bit more detailed tl;dr if you'd like, but it REALLY is worth the read.
Again, his code is nice, but it's not what's really important. The concept that you have sections of code that define how your object behaves for a given "state" and being able to keep that code separate and manageable is invaluable. I use it in everything from my overall game manager (state_mainmenu, state_ingame, state_options, etc) to my in game characters (state_stand, state_walk, state_run, state_jump, etc).
Whether you just keep all the state code in the object sectioned by if statements, or in different scripts... hell, I made a fighting game prototype where all of the states were timelines. It doesn't matter how you do it, just that you do do it.