Jump to content

Path with physics?


hollowdoor
 Share

Recommended Posts

I just finished using this tutorial to make a path, and use saved points in the update to make a sprite follow the path.

 

As it is I have no physics on the sprites, but I just realized the sprite movement has no speed controls.

 

Is there a way to use points from a path like this while updating physics properties?

 

Normally a sprite's x,y is subject to the update with velocity, but the x,y is being set explicitly here. I'm not using gravity. I just think it would be nice to speed up, or slow down the sprite along the path.

 

I don't see velocity working for this.

 

If there is an option that doesn't involve physics I would be fine with that too.

Link to comment
Share on other sites

Well it depends .. The tutorial shows a way for your item to move exactly along the path.. Iguess collissions will not work either if you set x and y directly..

I used a completely different approach.. totally physics based...

I placed several waypoints (small trafficcones from my tileset) on an object layer in tiled and gave them numbers.. In my code i used createfromobjects and created hidden numbered Sensor activated objects out oft them.. Then i used a custom acceleratetoobject function and everytime the object with the current target number is reached i advance the number counter by one and the Next object in line is the target..

it works and i can push the moving object away and it will try to reach its destination anyway.. oft course you will see an object running against a wall permanently if there is a wall in the way.. so its far from perfect.. but adding a litle bit more "intelligence" should be easy

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...