C
CountZer0
Guest
Hi all, sorry if this has been asked before but this one is driving me nuts.
I'm new to GM and have followed Shaun Spaldings Asteroid tutorial. I've embelished quite a bit (warp drive, change of sprites, bouncing rocks etc) but 1 bug is killing me but I can figure out.
Objects just disappear!
All the asteroids have a wrap in both directions when outside the room event/action and this seems to work. However, randomly asteroids that leave the playfield (room?) sometimes don't wrap and therefore seem to disappear and the room can't be 'cleared'.
I've added some test logic in that simply counts and displayed the number of instances present at every step and display the number to screen and when this bug occurs the count still says there are instances :/
What is supposed to happen (as per Shaun's tutorial) is that once all the asteroids are cleared this codes adds them again:
I've tested that this works by setting the T key to destroy all instances of obj_asteroid so I can see the them all get created again.
But I cannot for the life of me workout how/why some objects are leaving the room and not wrapping.
Anyone come across this before or might be able to point me in the right direction?
I've even just died (lost all 3 lives) without shooting and just left the game running and they slowly disappear...
I'm new to GM and have followed Shaun Spaldings Asteroid tutorial. I've embelished quite a bit (warp drive, change of sprites, bouncing rocks etc) but 1 bug is killing me but I can figure out.
Objects just disappear!
All the asteroids have a wrap in both directions when outside the room event/action and this seems to work. However, randomly asteroids that leave the playfield (room?) sometimes don't wrap and therefore seem to disappear and the room can't be 'cleared'.
I've added some test logic in that simply counts and displayed the number of instances present at every step and display the number to screen and when this bug occurs the count still says there are instances :/
What is supposed to happen (as per Shaun's tutorial) is that once all the asteroids are cleared this codes adds them again:
Code:
if (!instance_exists(obj_asteroid))
{
instance_create(random(room_width),random(room_height),obj_asteroid);
instance_create(random(room_width),random(room_height),obj_asteroid);
instance_create(random(room_width),random(room_height),obj_asteroid);
instance_create(random(room_width),random(room_height),obj_asteroid);
instance_create(random(room_width),random(room_height),obj_asteroid);
instance_create(random(room_width),random(room_height),obj_asteroid);
}
But I cannot for the life of me workout how/why some objects are leaving the room and not wrapping.
Anyone come across this before or might be able to point me in the right direction?
I've even just died (lost all 3 lives) without shooting and just left the game running and they slowly disappear...