I'm having some trouble trying to cause knockback when a player or enemy is hit (based on the direction the attacker is facing). I'm using MarteEngine for the entity framework. Think of a SNES Zelda-like action RPG.
I have a player entity, an attack entity, and an enemy entity. The only way I can tell would work is to make 4 different entities for my attack entities, one for each direction. I don't really want to do this because I am going to have many different attacks.
Here's what I have in my enemy class's update method, for example:
Code:
if(collide("attack", x, y) != null) {
addDamage(25);
}
How should I accomplish this without making different directional attack entities?