Is there any way to do this?
Each entity has a number of listeners for a number of different kinds of collisions. If it collides with something impassable, it will stop moving, if it collides with something damaging, it will take damage.
Many things should trigger multiple listeners.
Again, that is not one behavior that is triggered by multiple types of entities, – it is one entity that triggers multiple kinds of behaviors
edit: for what its worth, I have an easy solution to home brew this functionality. I just want to know if the functionality exists by default.
heres my solution:
First, I default everythings inherited type
to "generic"
.
Then, I give all entities a public variable collisionTypes:Object
that holds their various types.
Finally, when I check for a collision, I always check thing.collide("generic",x,y)
.
Then, I put the body inside of an if statement. like so:
impassableListener():Void
{
if(thing.collidething.collide("generic",x,y))
{
var collidedEntity = thing.collide("generic",x,y);
if(collidedEntity.collisionTypes has element "impassable")
{
//don't let the thing pass
}
}
}