Hello all, my turn to ask a question!
So I have an entity that needs to check if it is within anther entity, and if it is, block off a certain ability (several entities actually, in a tilemap). I’m using the following;
for each(var e: Region in entities) //entities is a list of all Regions
{
if(Global.player.collideWith(e, Global.player.x, Global.player.y) != null)
{
trace("COLLIDE");
//if there's a collision, we can't change
canChange = false;
}
}
My regions just use regular hitboxes (setHitbox(width, height)). The problem I’m having is that although it stops the player from changing if he overlaps the edge of a Region, if he is fully contained within it he can still change. I’m suspecting that the bounding box collision code in FlashPunk only checks edges of bounding boxes and not containment… in which case is there a way to check for containment? Or am I just doing something completely weird?
I’ve never done a platformer in FlashPunk before so all this collision stuff is actually pretty new to me!