• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

Trouble with post-draw instance destroy

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:
 
Top