• 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!

Legacy GM Extremely odd glitch in game[solved]

F

fxokz

Guest
In my game when im shooting a bigcoin in this specific location specifically with a machine gun my game just freezes. The weirdest part about it is that when i X out of the game the game sound still runs in the background?
This is what the game looks like when frozen:

FROZEN:




It only seems to happen when the coin is flashing red (which is 5 steps long) What could it be? The box and coin both use a local variable called "flash" to determine whether they are flashing red or not but i dont think that could be the issue. another possibility could be something to do with the blue box that is ignited. The coin never causes issues unless its this specific one?

edit: there are no messages in the compile box, no errors nothing..

edit2: there are no while or for loops that could be causing the game to pause. ALSO you can test it out for yourself, the game is called Journey in the WIP section of the forums
 
Last edited:

Tthecreator

Your Creator!
MMM... weird I would have really though this would be caused by a loop.

This looks like a case for..............Debug messages..........
Just add debug messages before and after every loop and try to find the source.
Debug message could look like: "show_debug_message("debug point 1")"
 
A

Ariak

Guest
This sounds like an infinite loop. It will completely halt your game, but the sound will continue just fine.
Check the big coin code for loops, or infinte creation of objects, thus creating a sort of loop.
 
F

fxokz

Guest
MMM... weird I would have really though this would be caused by a loop.

This looks like a case for..............Debug messages..........
Just add debug messages before and after every loop and try to find the source.
Debug message could look like: "show_debug_message("debug point 1")"
This sounds like an infinite loop. It will completely halt your game, but the sound will continue just fine.
Check the big coin code for loops, or infinte creation of objects, thus creating a sort of loop.
Hmmm thats weird man.. Ill keep checking the code to make sure there isnt any loops.. In the mean time ill post my obj info here.. This is every obj that is involved with this specific moment.

the object that is created when a bullet is destroyed:
Code:
Information about object: obj_bullet_explosion
Sprite: spr_bullet_explosion
Solid: false
Visible: true
Depth: -10
Persistent: false
Parent:
Children:
Mask:

No Physics Object
Create Event:

execute code:

randomize();
image_speed = 0.25;
image_angle = choose(0, 90, 180, 270);
image_xscale = choose(1, -1);

audio_play_sound(snd_bullet_explosion, 1, 0);

Other Event: Animation End:



execute code:

instance_destroy();


objbigcoin
Code:
Information about object: obj_bigcoin
Sprite: spr_bigcoin
Solid: false
Visible: true
Depth: 0
Persistent: false
Parent:
Children:
Mask:

No Physics Object
Create Event:

execute code:

///Init vars
image_speed = 0.05;
hp = 10;
flash = false;
pitch = 1;

execute code:

///Create Particles
//part_sys
part_sys = part_system_create();

//part_type
part_bigcoin = part_type_create();

part_type_sprite(part_bigcoin, spr_bigcoin_part, false, false, false);
part_type_gravity(part_bigcoin, 0.1, 90);
part_type_speed(part_bigcoin, 0.1, 0.1, 0, 0);
part_type_direction(part_bigcoin, 0, 359, 0 ,1);
part_type_orientation(part_bigcoin, 270, 270, 0, 0, 0);
part_type_life(part_bigcoin, room_speed/2, room_speed/2);

//part_emit
part_bigcoin_emit = part_emitter_create(part_sys);



Alarm Event for alarm 0:

execute code:

flash = false;

Step Event:

execute code:

///check if dead
if (hp < 1)
{
    part_system_destroy(part_sys);
    part_emitter_destroy( part_sys, part_bigcoin_emit );
    instance_destroy();
}

execute code:

///particle stream
if part_emitter_exists(part_sys, part_bigcoin_emit)
{
    part_emitter_region(part_sys, part_bigcoin_emit, x-32, x+32, y-32, y+32, ps_shape_ellipse, ps_distr_gaussian);
    part_emitter_stream(part_sys, part_bigcoin_emit, part_bigcoin, -6);
}

Collision Event with object par_bullet:

execute code:

var coin = instance_create(x, y, obj_coinpiece);
coin.vsp = irandom_range(-6, -3);
a = audio_play_sound(snd_bigcoin, 1, 0);
audio_sound_pitch(a, pitch);
pitch += 0.2;
if (flash = false)
{
    flash = true
    alarm[0] = 5;
}
hp --;
with(other)
{
    bullet_destroy();
}

Other Event: Game End:

execute code:

///destroy part
part_system_destroy(part_sys);
part_emitter_destroy( part_sys, part_bigcoin_emit );

Other Event: Room End:

execute code:

///destroy part
part_system_destroy(part_sys);
part_emitter_destroy( part_sys, part_bigcoin_emit );

Draw Event:

execute code:

draw_self();
if flash = true
{
    image_blend = c_red;
} else image_blend = c_white

the blue crate:
Code:
Information about object: obj_bigcoin
Sprite: spr_bigcoin
Solid: false
Visible: true
Depth: 0
Persistent: false
Parent:
Children:
Mask:

No Physics Object
Create Event:

execute code:

///Init vars
image_speed = 0.05;
hp = 10;
flash = false;
pitch = 1;

execute code:

///Create Particles
//part_sys
part_sys = part_system_create();

//part_type
part_bigcoin = part_type_create();

part_type_sprite(part_bigcoin, spr_bigcoin_part, false, false, false);
part_type_gravity(part_bigcoin, 0.1, 90);
part_type_speed(part_bigcoin, 0.1, 0.1, 0, 0);
part_type_direction(part_bigcoin, 0, 359, 0 ,1);
part_type_orientation(part_bigcoin, 270, 270, 0, 0, 0);
part_type_life(part_bigcoin, room_speed/2, room_speed/2);

//part_emit
part_bigcoin_emit = part_emitter_create(part_sys);



Alarm Event for alarm 0:

execute code:

flash = false;

Step Event:

execute code:

///check if dead
if (hp < 1)
{
    part_system_destroy(part_sys);
    part_emitter_destroy( part_sys, part_bigcoin_emit );
    instance_destroy();
}

execute code:

///particle stream
if part_emitter_exists(part_sys, part_bigcoin_emit)
{
    part_emitter_region(part_sys, part_bigcoin_emit, x-32, x+32, y-32, y+32, ps_shape_ellipse, ps_distr_gaussian);
    part_emitter_stream(part_sys, part_bigcoin_emit, part_bigcoin, -6);
}

Collision Event with object par_bullet:

execute code:

var coin = instance_create(x, y, obj_coinpiece);
coin.vsp = irandom_range(-6, -3);
a = audio_play_sound(snd_bigcoin, 1, 0);
audio_sound_pitch(a, pitch);
pitch += 0.2;
if (flash = false)
{
    flash = true
    alarm[0] = 5;
}
hp --;
with(other)
{
    bullet_destroy();
}

Other Event: Game End:

execute code:

///destroy part
part_system_destroy(part_sys);
part_emitter_destroy( part_sys, part_bigcoin_emit );

Other Event: Room End:

execute code:

///destroy part
part_system_destroy(part_sys);
part_emitter_destroy( part_sys, part_bigcoin_emit );

Draw Event:

execute code:

draw_self();
if flash = true
{
    image_blend = c_red;
} else image_blend = c_white

There is a while loop in the player collision code but i dont think that is relevant..
Is there anything else that could be useful for the search?

how can i forget... the bullet itself
Code:
Information about object: obj_machinegun_bullet
Sprite: spr_bullet_mg
Solid: false
Visible: true
Depth: -10
Persistent: false
Parent: par_bullet
Children:
Mask:

No Physics Object
Create Event:

execute code:

image_xscale = obj_player.image_xscale;
image_index = 0;
image_speed = 1;
alarm[0] = (room_speed/2)-5;

Alarm Event for alarm 0:

execute code:

bullet_destroy();

Step Event:

execute code:

if (image_index > 0) image_speed = 0;
 
F

fxokz

Guest
SOLVED.............. The game freezes because when the small coin is created it is put into a never ending while loop which destroys the game. So basically the blue box has to be a certain pixel radius away from the big coin
 
Last edited:
Top