J
JollyLemon
Guest
Hi,
I made a simple enemy AI system using states. I'm trying to create an enemy attack hitbox for 1 frame whenever the sprite_index = spr_zombie_attack and image_index==1.
I put this in the enemy step event:
And in obj_zombie_hitbox PostDraw event I put:
But the hitbox never appears. Whenever the enemy is in range, the animations and all work but the hitbox never gets created :s
Anyone have any tips?
Thanks for reading BTW!
I made a simple enemy AI system using states. I'm trying to create an enemy attack hitbox for 1 frame whenever the sprite_index = spr_zombie_attack and image_index==1.
I put this in the enemy step event:
Code:
case zombie_state.attack:
{
if (!attacking)
{
attacking = true;
sprite_index = spr_zombie_attack;
image_speed = 0.12;
image_index = 0;
//Hitbox
if (image_index==1)
{
with (instance_create (x,y,obj_zombie_hitbox)) //Create hitbox
{
image_xscale = other.image_xscale; //Create the hitbox in the right direction
}
}
movespeed = 0;
}
if (distance_to_object (obj_player) > 30) state = zombie_state.chase;
}
break;
Code:
instance_destroy ();
Anyone have any tips?
Thanks for reading BTW!