Anna Posted March 14, 2017 Share Posted March 14, 2017 Hi, I am using pathfinding.js to find path. once i get the path I need to provide continuous object movement through the path !! Can someone help me here!!! Quote Link to comment Share on other sites More sharing options...
Parasyte Posted March 14, 2017 Share Posted March 14, 2017 You can recompute the path if there is an object in contact with it and the object is close to your path-finding object (with some threshold). In short, recompute the path when it is potentially blocked in the immediate future. This might create non-optimal paths, or even unreachable destinations, so keep that in mind. Use me.Line objects to create collision triggers along the path, and recompute the path on collision AND distance between object position vectors. Quote Link to comment Share on other sites More sharing options...
Hashasm Posted March 15, 2017 Share Posted March 15, 2017 If I have the Path array already defined ,how can i move sprite through the particular path repeatedly. like this https://github.com/Kibo/melonjs-cookbook/tree/master/cookbook/patrol in my isomatric map. when i am trying to reuse the functions its throwing error because the melonjs version which they have used in this example is version 0.9.9. BUT i am using 4.1.0 can any one help me on this.. Quote Link to comment Share on other sites More sharing options...
Parasyte Posted March 16, 2017 Share Posted March 16, 2017 Just update the code to melonJS 4.1.0! Here are the changes I can see just by looking through the code on github (I haven't tried it): me.ObjectEntity -> me.Entity this.maxVel -> this.body.mexVel this.vel -> this.body.vel this.accel -> this.body.accel update method -> accepts a single argument named dt (delta-time) this.super() -> this._super(me.Entity, 'update', [ dt ]) this.updateMovement() -> this.body.update(dt) And here's the update guide, which will help you for any other problems you might find when running old code with a new library: https://github.com/melonjs/melonJS/wiki/Upgrade-Guide Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.