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

Bug Help!!

S

Stratos.la

Guest
GML:
if mouse_check_button_pressed(mb_left)
{

    click += 1;
}
if (click = 1)
{
    layer_set_visible("hint",true)
}
if (click = 2)
{
layer_set_visible("hint",false)
layer_set_visible("Health",true)
}
if (click = 3)
{
layer_set_visible("health",false)
layer_set_visible("Draw",true)
instance_create_layer(x,y,"Instances",oCombatMechanics2)
    if instance_exists(oCombatMechanics2)
    {
        alarm[1] = 1 * room_speed
    }
}
i have this code in my step event for a tutorial room. from the debugger when i reach click 3 instead of spawning one instance of the oCombatMechanics2 it spawns infinetly , the game lags frame rate drops etc etc. Why!!?? im not seeing anything wrong with it!

and this is the alarm

GML:
layer_set_visible("Draw",false)
layer_set_visible("Hit",true)
instance_create_layer(1940,1020,"Instances",obj_enemyTutorial)
alarm[1] = 0;
and i have another alarm on the spawned enemy that when he gets hit it returns to the alarm of the other object to show a final layer and go to room.

GML:
with oTutorial
{
    layer_set_visible("Hit",false)
    layer_set_visible("Ok",true)
    alarm[0] = 3* room_speed
}
 

Simon Gust

Member
It spawns indefinetly because the code is running in the step event. I take it you wanted it to run once upon mouse press. In that case, pull the code section inside the brackets of mouse_check_button_pressed and below click += 1
 
S

Stratos.la

Guest
It spawns indefinetly because the code is running in the step event. I take it you wanted it to run once upon mouse press. In that case, pull the code section inside the brackets of mouse_check_button_pressed and below click += 1
ive never been more happy with a reply in my life!! You sir are a Hero! thank you wow i mean just wow i dont know how i missed it or well maybe i didnt know it! pffff thank you very much!
 
Top