Sign in to follow this  
Anna

pathfinder in melonjs

Recommended Posts

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!!!

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

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..

Share this post


Link to post
Share on other sites

Just update the code to melonJS 4.1.0! :P 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

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.