Best way for npc character to chase player in isometric game
Shri

Gio,

 

I have another question.

 

What's the best way to chase a human character with a computer controlled  character (npc) in wade ?

 

Right now, I have the npc use goToObject('player').

And then onDestinationReached I call it again if the player is still alive.

 

My understanding is that onDestinationReached fires when a leg of the journey is finished and onMoveComplete fires when the entire path has been completed (not sure if I have that straight).

 

This works pretty well, but if the npc has a long straight path to the player, the onDestinationReached fires long after the player has moved. I was wondering if there was another event I could catch which would make the npc modify its movement direction faster

 

I figured I could create something on my own and check where the player is every 100ms or so in a timeout loop, but I was wondering if you guys had already packaged something into wade or the iso plugin I could use instead. 

 

b.t.w. thanks for the tip about fadeOutLayer for the light effect. It looks really cool. I would never have discovered that on my own

 

cheers,

Shri

 

 

1 Comment
Gio
Hi Shri

I think checking every so often is probably your best option at the moment. I wouldn't do it TOO often, or it may slow everything down.

Just so you know, we are working on asynchronous (multi-threaded) pathfinding for the iso plug-in, which would make this much faster.

I think that adding a follow() method to iso characters would be a great idea, and I'll keep it in mind for the next release.
Post a reply
Add Attachment
Submit Reply
Login to Reply