Megaman style platform

Hey Guys,

Very new to game dev in general but im having hard time programming my main character engine. Currently this is my code (jpeg attached).

Main problems im having are;

if you just hold up he keeps jumping rather then stopping the button press and making the user press up again.
Animation on jump only changes for a second then goes back to the X movement animation.
Space key which is gonna be “shoot” doesn’t change and hold an animation either.

If someone could help or even better give me some code to make a sprite behave like megaman (nes version) that would be great. If i cant work this out i have to switch to RPG Maker :frowning:.

Cheers,

1 Like
  1. if you just hold up he keeps jumping rather then stopping the button press and making the user press up again.

Put Do = 1 to Variable jumping in the actions when up key is pressed and add Variable jumping = 0 to the conditions . So you should have:

Up key is pressed || Set linear speed;
Linear velocity on y = 0 || pause animation
Variable jumping = 0 || Do = 1 to variable jumping

Then have another event which is simply:

Up key is NOT pressed - Do = 0 to Variable jumping

  1. The jump animation needs.

Do = 0 to animation frame of mainman
Play animation of mainman

Make sure that you have more than one frame in the animation and change the time between frames to a suitable number. The default is 1 (i.e. 1 second). You will probably need a value more like 0.1 in there.

  1. Space key which is gonna be “shoot” doesn’t change and hold an animation either.

Same problem. You need to do:

Do = 0 to animation frame of mainman
Play animation of mainman

In future, it will be more helpful to upload your actual program than to take a screenshot of it. Then I can load up your code in GD and edit it instead of having to write it all out myself in GD. :wink: