Basic question on movement

0 favourites
  • 4 posts
From the Asset Store
Run and Jump in 3 Dimensions! Take your platformer to the next level!
  • Hi, I am making a little 2d space game with construct 2 and I am having some trouble with movement.

    I have it setup custom movement so when the player holds down the up arrow the ship will accelerate at the ship angle, same with the down arrow but at a negative acceleration. I also have a event that will stop the ship going too fast.

    The problem I am having is that I want the ship to slow down to 0 when no arrow keys are pressed (not just stop) but I can't work out how to do it. I tried making an event that when the up arrow key was released and the speed is greater than 0 to set acceleration at -100 but it doesn't seem to work.

    If anyone could give me some advice on how to accomplish this that would be great.

    Sorry I know this is a really basic question but I just can't work it out I am very new to construct.

  • hello,

    you can have an event that activates while the ship is moving (speed > 0). this way, if no arrows are pressed, and the ship is moving, it will always execute. in this event, set your ships speed to (speed * 0.99). this will gradually decrease your ships speed to zero over time. if the slow down is too slow for your taste, simply experiment with decreasing the decimal value eg; 0.95, 0.90, 0.80 etc...

    hope this helps you. i used this method in two of my own c2 space ship experiments.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Awesome thanks for your fast reply harrio I really appreciate it. <img src="smileys/smiley4.gif" border="0" align="middle" />

  • Are you using your own custom movement or this:

    http://www.scirra.com/forum/behavior-spaceship-movement-behavior_topic44038.html

    ?

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)