Jump to content

pathfinder in melonjs


Recommended Posts

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.

Link to comment
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..

Link to comment
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

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.
Note: Your post will require moderator approval before it will be visible.

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.


  • Recently Browsing   0 members

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