Hi! I’am creating a platformer with a melee attack. I’m trying to get my character to stop moving when pressing the attack button. I have been trying this many times with many different methods and outcomes but without luck.
My player character should stop and perform the attack animation even if the movement keys are pressed. The attacking works correctly when not moving but it doesn’t work when moving.
With the codes that I have tried the character either doesn’t attack at all or stutters a bit but doesn’t play the animation.
I have made a version of my game that only has the character, ground and a background. I’m attaching it to here because there is too much code to send in screenshots.
Google Drive link because idk how to attach a .zip file
Instead of linking to a zipped file of the game source, screen shot the events that control the character movement and attack. That shouldn’t be too much.
This is definitely not all the character code but I think it’s the most important code to solve my problem
Is this the kind of thing you’re after? I held down “a” until I got to the left side, then held down “d” until I got to the right. In between I pressed “k”:
If this is what you’re after, here are the changes:
cleaned up first event and put the “k key pressed” event by itself as the first subevent
Moved the “Movement animation and sfx” to under the “not attack animation” check
Moved the delete AttackCollision event as a subevent of the create AttackCollision event
Yes exactly like that. Thanks for the help