Not let a sprite move backward on a track

  • 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?

  • 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.

    capx

  • 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 :)

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • 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.

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