Basic question on movement

Discussion and feedback on Construct 2

Post » Sun Aug 21, 2011 6:38 am

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.
B
4
G
2
Posts: 6
Reputation: 1,217

Post » Sun Aug 21, 2011 6:52 am

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.
B
50
S
17
G
15
Posts: 1,029
Reputation: 26,289

Post » Sun Aug 21, 2011 7:03 am

Awesome thanks for your fast reply harrio I really appreciate it.
B
4
G
2
Posts: 6
Reputation: 1,217

Post » Sun Aug 21, 2011 11:40 am

Are you using your own custom movement or this:
http://www.scirra.com/forum/behavior-spaceship-movement-behavior_topic44038.html
?Fimbul2011-08-21 11:40:37
B
35
S
8
G
8
Posts: 532
Reputation: 6,868


Return to Construct 2 General

Who is online

Users browsing this forum: Rexu, veeru5656 and 7 guests