Better method for checking if should move isometric objects
Shri

Gio,

 

I have a situation in a game I am working on where certain iso characters move away from another iso character in a fleeing like behavior.

Sometimes, the fleeing iso characters end up in the same iso cell. I then want to separate them and make one move away randomly.

Right now, my separation pseudo code is like this

     - Check if this object has overlapping objects - sceneObject.getOverlappingObjects()

     - Check if overlapping object is  in same isometric cell - custom function using getPosition() and getCellCoordinates()

     - Check if overlapping object is not moving - sceneObject.isMoving()

 

If all three conditions are true,  then move away in a random direction.

 

I don't want to use collisions or collision maps.

 

My question is - is there a more succinct way of doing this ?

 

thanks,

Shri

 

P.S. Thanks for posting the description and code for the zirma menu.

1 Comment
Gio

Hi Shri

 

Keeping in mind that this could be all wrong because I've been working with a significantly different version of the iso plugin for some time (to be released in the next couple of weeks)...

 

Checking for overlaps is not ideal. Things  could be overlapping even if they are not in the same iso cell, and things that are in the same iso cell may well not be overlapping on the screen.

 

I believe the iso plugin has got a wade.iso.getObjectsInCell() function, where you pass in the (x, z) cell coordinates and it gives you an array of objects in that cell. That would save you a few steps. You would still need to call SceneObject.isMoving() if that's relevant to your game's logic.

Post a reply
Add Attachment
Submit Reply
Login to Reply