• Hey! Guest! The 40th (!!!) GMC Jam will take place between February 25th, 12:00 UTC to March 1st 12:00 UTC. Why not join in this very special anniversary jam! Click here to find out more!

GMS 2.3+ Bug Help!!

Stratos.la

Member
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
 

Stratos.la

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