Not let a sprite move backward on a track

Get help using Construct 2

Post » Thu Nov 07, 2013 7:34 am

Please have a look into this game
54.235.220.31:9080/racecar1

In this game the car follows the mouse. I need to restrict the movement of the car in the reverse direction even if the mouse moves to a previous position on the track. How can I achieve this in Construct2?esafzay2013-11-07 07:37:38
B
4
S
1
Posts: 9
Reputation: 345

Post » Thu Nov 07, 2013 10:24 am

@esafzay do you want more than that ?
[EDIT] if you don't want the car to move back on the track, one option is to to Pin (in rope stile) an invisible large sprite behind the car (like a trailer), and when the car go back and hits the trailer you stop it from moving. 2-nd option is to make segments on the track itself, each having an instance variable with an ascending value. car is holding the segment value that is passing on and if the segment value is smaller than stop the car.
capxCipriux2013-11-07 10:56:39
B
84
S
21
G
23
Posts: 521
Reputation: 18,789

Post » Fri Nov 08, 2013 8:06 am

@Cipriux Thank you so much. Your second option helped me find my solution. I tried the first option by pinning the car to an object, but the car won't drag it with itself.

And your algorithm for not letting the car go in reverse is a very ingenious one :)
B
4
S
1
Posts: 9
Reputation: 345

Post » Fri Nov 08, 2013 8:48 am

@esafzay glad I could help:)
P.S. The first option was to pin the object to the car, not the car to the object.Anyway, good to know I was of any help.Cipriux2013-11-08 08:54:57
B
84
S
21
G
23
Posts: 521
Reputation: 18,789


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 16 guests