0 Favourites

Best way object follow predefined route

  • Hi guys,

    i want that objects follow a predefined route in a loop like cars on a race track.

    What is the best approach to do that?

    The objects should follow the path pixel-precise every round with different speed depending on object and track state.

    How could i describe the route, maybe more than one possible racing line?

    I've got no idea where to start.

    Any suggestions?

    Thx in advance

  • Construct 3

    Buy Construct 3

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

    Buy Now Construct 3 users don't see these ads
  • I usually use the MoveTo (3rd party behavior by rex)

    Then put invisible sprite blocks around. MoveTo block 1 and on collision, move to the next block.

  • If you don't want to use a 3rd party Plugin, I'd use the Pathfinder behaviour, and plot a bunch on 8x8 sprites with a numeric variable, that goes from sprite instance 1, to sprite instance 2 etc. That way it's organic looking, and you can use it on any PC without having to install the plugin each time.

  • I'll have a look at the pathfinding behavior, thanks.

    I think problem could be that the pathfinding don't provide exact results in respect of reproduceable "round time" of an object with given speed.

    In the end i want that the object with a given speed produce every round the same time (exact to the thousand of a second) until speed changes.

    By the way, how could i set a "next_waypoint" instance variable of a waypoint-sprite (maybe the UID of the next) like a singly-linked list at startup?

    Can i loop through a ordered (UID) list of all instances (created with the editor, not programatically) and assign every instance the proper value?

    Thx in advance!

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