It’s me back with my fighting game questions. Basically, in the frames of the animations, events are dispatched. When one is being dispatched, I dont want the other one’s function to be performed…I’m probably making this alot more confusing than it is supposes to be… If you can just picture it, in a fighting game I dont want the enemy to take damage, while both he and the player are colliding and attacking (whichever one was attacking first). geez that was a ramble.
Here is what I have: any suggestions? It should be pretty self explanatory. the enemyhit is dispatched by the player, and vice versa for the enemy.
public function playerHit(hittingevent:HittingEvent):void
{
if (fighter.hitTestObject(enemy) && (enemyHit !=true))
{
if (PixelPerfectCollisionDetection.isColliding(fighter,enemy,this,true))
{
fighter.y-=3;
canMove = false;
isJumping = false;
isAttacking = false;
i**** = true;
dy = fighter.y - enemy.y;
dx = fighter.x - enemy.x;
//Radians = Math.atan2(dy,dx);
}
}
}
public function enemyHit(hittingevent:HittingEvent):void
{
if (fighter.hitTestObject(enemy) && (playerHit!=true))
{
if (PixelPerfectCollisionDetection.isColliding(fighter,enemy,this,true))
{
removeChild(enemy);
}
}
}
}