slicky-grease
Member
I programmed a hurt box for my enemy and it is working perfectly. I have it so that when the enemy gets destroyed, the hitbox gets destroyed with. When I have 2 enemies in the room and when I destroy one enemy, all of the hitboxes get destroyed. What I want to happen is when a specific enemy gets destroyed, the hitbox that is associated with that enemy gets destroyed.
This is in the destroy event
Also, another issue I have is when I attack an enemy, he will always go to the right when attacked. I am trying to program it so that he is going in the direction that he is getting attack from.
Create
In Step
In End Step
This is in the destroy event
GML:
with(other)
{
instance_destroy(obj_hurtbox)
}
Create
GML:
facing = 1
GML:
//Flipping Sprites
if (dir != 0) image_xscale = sign(dir);
GML:
//get hit
if(hit){
hsp = hitBy.xHit;
hitStun = hitBy.hitStun;
facing = hitBy.owner.facing * -1;
hp -= hitBy.damage
hit = false;
sprite_index = spr_grunthit;
grunt = grunt.hurt;
}