r/gamemaker • • 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.

Attacking Code

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.

5 Upvotes

34 comments sorted by

View all comments

Show parent comment

1

u/ZeCatox Jun 07 '14

No, the line you had that "worked that way" was more certainly luck/misunderstanding on your part :)
The way it works :

alarm[alarm_id] = steps_number

setting alarm[0] to -1 is the same as deactivating it
as I said, there is a good chance (I don't have time to make sure) that setting alarm=60 would be the same as doing alarm[0]=60. So if you had a line that did this :

alarm[0]=-1 alarm = 60;

Then it could most certainly the same as doing this :

alarm[0] = -1; // deactivate alarm0
alarm[0] = 60; // reactivate alarm0 and set it to trigger in 60 steps
               // this second line makes the first one absolutely useless

I think that's about it about alarms :)

1

u/1magus Jun 07 '14

You may be right XD let me go check, lol. Was that the only thing I got lucky on?