Making sprite follow a predefined path

  • Hi,

    I working on a game which involves moving the player in a 8 shaped racing track automatically on start of the game.

    Trace shape reference: http://www.gettyimages.in/detail/illust ... /514730893

    One way I can think of based on the information from another threads and tutorials is creating placing sprite blocks and on overlap change the sprite direction and angle. But this involves creating lot of sprites and associating direction and angle for each sprite node which is a very tedious process.

    Is there a easy way to do it like draw a line along the race track and sprite follows the path.

    Thanks in advance

  • Create nodes that your sprite follows

  • I also wish there was an easy way to create weighted paths or splines that objects could follow. Maybe there is a plugin for that, not sure. The pathfinding can find the a route between points. Did you try it out?

  • I've asked a few times for a spline based pathing implementation, and there is supoport from the user community but i dont think it's really something thats on Scirra's radar.

    It's also requested for Construct 3. maybe some dev will be able to make a plugin. If i knew more on the coding side of things I would have attempted this myself.

    Fusion has a very nice one.

    The video shows only straight movement but bezier curve movement - back and forth, looping etc are all possible.

    Subscribe to Construct videos now

    Would be great to have something like this in Construct.

    Currently as others have said you can make nodes that you can have the sprite move to, once it gets to the sprite let it look for the next sprite and so on.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • you want something like this?

    (quick example with 3 events/ need gmail account )

  • Thanks everyone!

    MadSpy: Yes I wanted something similar to this.

    Are you using nodes and move to as others suggestion?

    Can you please share the capx if possible for reference.

    Thanks!

  • Just multiple instances of a sprite named "Path" that I place on the track. Bullet behavior for "car"

    And a rotational movement to the angle of the next sprite.

    6 minutes of work and 3 events

    It is possible to improve it by putting two or three conditions and adding instance variable to the "car"

    You can also use the pathfinding plugin but it increases CPU usage... depends of what you want and number of objects/solid...

    Yes, I'll share the capx asap

  • Thanks MadSpy

    I'm trying out what you suggested. I'm still a newbie and your capx would definitely help me to fast track.

  • As promise, here is the capx

  • Is there any way to make that curved movement instead of it going directly to the points?

  • You mean: the object rotates only in cornering with homogeneous movement?

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