Jump to content
MakeWebGames

Pre-Defined Path Following [JavaScript]


Sim

Recommended Posts

You say pre-defined, does that mean you simply have it coded so that it does a certain action once it gets to a certain point? What would be impressive, whilst also challenging, is if you set up an object called boundary, then you set up a load of boundaries, and gave the box a bit of AI code in which it decides for itself what way it should go to navigate it's what through the path.

You have it determine where boundaries are and move in a direction away from the boundary, but never back on itself, done by storing the previous direction and preventing it from going back that way.

Link to comment
Share on other sites

You say pre-defined, does that mean you simply have it coded so that it does a certain action once it gets to a certain point? What would be impressive, whilst also challenging, is if you set up an object called boundary, then you set up a load of boundaries, and gave the box a bit of AI code in which it decides for itself what way it should go to navigate it's what through the path.

You have it determine where boundaries are and move in a direction away from the boundary, but never back on itself, done by storing the previous direction and preventing it from going back that way.

 

This is a basic concept used in a lot of games. I can't remember the exact name of the concept. It has the words chain and tween in it. It may be called Chain Tweening or something. More advance one's use radius around the grid point's it is suppose to go to, so it doesn't have to travel from point a->b->c, but can hit anywhere on the radius.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...