Lacking follow through! (2-D SS attack animation woes)

gw4

Member
Hello again!

So with some references on where to look to find stuff (Thanks, Felbar!) I've come a long way in the past couple weeks. I've integrated state scripts and my character's animations are where I want them except for ONE issue:

Upon pressing the attack button, my character *still* raises his arm but does not complete all the attack frames for the swing. When I release the attack button he returns to free state, but then I press it again and... it would be a great feint mechanic but not quite what I'm looking for right now lol.

I would appreciate it if you guys could have a look and help me determine how to get him to complete the attack animation. Below is a collage of all relevant code in hopes that somebody might see something I don't. Please excuse it if it looks a little messy right now. :)I've looked at some Spaulding code, Heartbeast tutorials, and several other melee tutorial video and posts but I can't get him to follow through lol

Thanks for your time!

Heeellllp.png
 

CloseRange

Member
I much prefer if you put code in the forms
GML:
like this
an maybe even around some spoiler tags but it's fine.

Anyway in your PlayerState_Attack you are setting image_index = 1.
This runs on step so as long as you are in the attack state, it is setting the index to 1, every frame. That's why it's stuck on the same place.
Remove both 'image_index = 1' bits from the PlayerState_Attack and put it where you do 'if keyboard_check_pressed(ord"A"))
It's located at the bottom of PlayerState_Free.

Essentially you wanna set the frame to 1 when you change to the attack state, just not constantly (also you might want to change it from 1 to 0 unless you don't care about frame 0 of the attack frame)
 

gw4

Member
Anyway in your PlayerState_Attack you are setting image_index = 1.
This runs on step so as long as you are in the attack state, it is setting the index to 1, every frame. That's why it's stuck on the same place.
Remove both 'image_index = 1' bits from the PlayerState_Attack and put it where you do 'if keyboard_check_pressed(ord"A"))
It's located at the bottom of PlayerState_Free.

Essentially you wanna set the frame to 1 when you change to the attack state, just not constantly (also you might want to change it from 1 to 0 unless you don't care about frame 0 of the attack frame)
That got me closer to the goal! When I walk forward, he now stops and fully does the attack motion. Same thing when he's standing still, though. Hmm...
 

Felbar

Member
There is something wrong with the enum in the animation end script maybe, it should be red.
try putting the PLAYERSTATE enum in a script file instead of in the create event
like make a script called init and put the enum in there
 

gw4

Member
There is something wrong with the enum in the animation end script maybe, it should be red.
try putting the PLAYERSTATE enum in a script file instead of in the create event
like make a script called init and put the enum in there
when I clicked it turned red.
 

Felbar

Member
so are you saying it's not stopping after Animation_End is called?
maybe throw in a show_debug_message("changed state to free")
right after you set state to free in Animation_End to see if the code
is actually getting there
 

gw4

Member
so are you saying it's not stopping after Animation_End is called?
maybe throw in a show_debug_message("changed state to free")
right after you set state to free in Animation_End to see if the code
is actually getting there
Gotta step out for a bit so I'll do some research when I get back and let you know!
 

gw4

Member
Got it figured out! Even found a way to better condense my code!

Thanks for your help, CloseRange and Felbar!
 
Top