J
Jorex
Guest
I have coded for a hitbox to be created when the player is attacking like so:
// Hitbox
if (image_index >=0) && (image_index <1)
{
with(instance_create_depth(x,y,0,obj_hitbox))
{
image_xscale = other.image_xscale;
with (instance_place(x,y,par_enemy))
{
if (hit == 0)
{
hp = hp - .25;
vspd = -3;
hspd = sign(x - other.x) * 2.5;
image_xscale = sign(hspd) * -1;
}
}
}
}
now with the object hitbox, I have a post-draw event set to simply:
instance_destroy;
and it works, IF the object is set to visible. If I uncheck the box "visible" then the game acts as if the object has never been destroyed and the enemies are getting hit by nothing.
here is a video example:
// Hitbox
if (image_index >=0) && (image_index <1)
{
with(instance_create_depth(x,y,0,obj_hitbox))
{
image_xscale = other.image_xscale;
with (instance_place(x,y,par_enemy))
{
if (hit == 0)
{
hp = hp - .25;
vspd = -3;
hspd = sign(x - other.x) * 2.5;
image_xscale = sign(hspd) * -1;
}
}
}
}
now with the object hitbox, I have a post-draw event set to simply:
instance_destroy;
and it works, IF the object is set to visible. If I uncheck the box "visible" then the game acts as if the object has never been destroyed and the enemies are getting hit by nothing.
here is a video example: