J
jana
Guest
I'm having serious crashing issues with my game, when I press the escape key or the quit button:
and when I click my game restart button
There were no crashing issues until I added the particle systems. It doesn't crash if I play the game for a minute then press the escape key. It always crashes if I play for 10 minutes then press the escape key. It'll crash if I play for a shorter period of time, but use a lot of the particle systems. Sometimes it crashes when a keystroke creates a particle system. So, I'm thinking I'm not properly destroying the partcle systems.
Most of the effects are bursts, but there are two that follow the object for a while, and these two effects crash the game the fastest.
With one of them, when my object is in a certain state, called blocked, an effect appears on top of it and stays until it gets unblocked. Video below. The red triangle will get a red cloud around it:
http://www.screencast.com/t/dV7xRvL9QXlc
The state variable "blocked" is set using a keystroke, then the object watches for it in the step event and adds the cloud if blocked is true:
Then I destroy the system for the last time when the object is unblocked, which could happen in two places in the code, when a certain condition is met, and I use this same code in both places:
I wasn't sure how to do this to make sure that the effect would be there for the whole time the object is blocked. So I'm recreating the system each step, after destroying the one for the previous step. Could this be the source of my crashing issue? After I added the two lines that destroy the previous system
the number of crashes went way down. But maybe there's another way to do this?
Also, as I indicated at the beginning of my post, I'm checking on game end and when I go to a new room for particle systems that somehow didn't get destroyed, and destroying them, using code similar to the two lines above, for each particle system in the game. Maybe it's overkill - crashing the game?
Any comments/suggestions gratefully appreciated.
Code:
// destroy particle systems and do other cleanup
game_end();
Code:
// remove particle systems and do other cleanup
(room_goto(rm_menu))
Most of the effects are bursts, but there are two that follow the object for a while, and these two effects crash the game the fastest.
With one of them, when my object is in a certain state, called blocked, an effect appears on top of it and stays until it gets unblocked. Video below. The red triangle will get a red cloud around it:
http://www.screencast.com/t/dV7xRvL9QXlc
The state variable "blocked" is set using a keystroke, then the object watches for it in the step event and adds the cloud if blocked is true:
Code:
if(blocked)
{
if(part_type_exists(particleVibratingRedCircle)) {part_type_destroy(particleVibratingRedCircle);}
if(part_system_exists(par_vibratingRedCircle)) {part_system_destroy(par_vibratingRedCircle);}
par_vibratingRedCircle = part_system_create();
particleVibratingRedCircle = part_type_create();
part_type_shape(particleVibratingRedCircle,pt_shape_ring);
part_type_size(particleVibratingRedCircle,0.10,0.49,-0.29,0);
part_type_scale(particleVibratingRedCircle,3.00,3.65);
part_type_color3(particleVibratingRedCircle,255,255,255);
part_type_alpha3(particleVibratingRedCircle,0.94,0.47,0.00);
part_type_speed(particleVibratingRedCircle,4.59,8.34,0.32,0);
part_type_direction(particleVibratingRedCircle,0,359,0,6);
part_type_orientation(particleVibratingRedCircle,49,236,0.40,3,1);
part_type_blend(particleVibratingRedCircle,0);
part_type_life(particleVibratingRedCircle,36,41);
part_particles_create(par_vibratingRedCircle,x,y,particleVibratingRedCircle,15);
}
Code:
if(obj_conductor.challengerIsBlockedCount < 1)
{
blocked = 0;
if(instance_exists(par_vibratingRedCircle))
{
part_system_destroy(par_vibratingRedCircle);
}
}
Code:
if(part_type_exists(particleVibratingRedCircle)) {part_type_destroy(particleVibratingRedCircle);}
if(part_system_exists(par_vibratingRedCircle)) {part_system_destroy(par_vibratingRedCircle);}
Also, as I indicated at the beginning of my post, I'm checking on game end and when I go to a new room for particle systems that somehow didn't get destroyed, and destroying them, using code similar to the two lines above, for each particle system in the game. Maybe it's overkill - crashing the game?
Any comments/suggestions gratefully appreciated.
Last edited by a moderator: