Alarm not working!

V

veko

Guest
Hello, so i have my caracter that can dash and when he dashes through enemy i set room speed to 10, just to give a little bit of "jucie" to game by having time slow down for a split second, and then i set alarm[1]=2;
and on that event it sets back the room speed to 30 again, for some reason it's not working!
CODE:
on obj_player
event: collision with obj_enemy
if global.isDashing = true
{
room_speed = 10;
instance_destroy();
score ++;
alarm[1] = 2;
}

alarm 1:
room_speed = 30;

Can someone help me out on this, please?
 

matharoo

manualman
GameMaker Dev.
CODE:
on obj_player
event: collision with obj_enemy
if global.isDashing = true
{
room_speed = 10;

instance_destroy();
score ++;
alarm[1] = 2;
}

alarm 1:
room_speed = 30;

Can someone help me out on this, please?
You're destroying the object. How is it supposed to execute the alarm?
 

Conbeef

Member
if global.isDashing = true
{
room_speed = 10;
instance_destroy();
score ++;
alarm[1] = 2;
}

aren't you destroying the instance before it even executes?
 

Conbeef

Member
Also you should check if the alarm is equal to -1 before you set it, else it will loop.

Code:
if global.isDashing = true
{
room_speed = 10;
instance_destroy();
score ++;
if alarm[1] == -1
{
    alarm[1] = 2;
}
}
 

matharoo

manualman
GameMaker Dev.
Create an object called obj_normalspeed
Create event:
Code:
alarm[0] = 2;
Alarm 0 event:
Code:
room_speed = 30;
instance_destroy();
Change your collision code to:
Code:
if global.isDashing = true
{
room_speed = 10;
score++;
instance_create(x, y, obj_normalspeed);
instance_destroy();
}
Do this if you want to execute an alarm after destroying your object.
 
V

veko

Guest
if global.isDashing = true
{
room_speed = 10;
instance_destroy();
score ++;
alarm[1] = 2;
}

aren't you destroying the instance before it even executes?
nope, code is set to other, so it destroys obj_enemy, not the player, that actually made me realize that sets the alarm 2 on enemy, not the player so i made two seperate codes, one that destroys other and one targeted on "self" and that adds +1 to score sets alarm and room speed, thanks! what you sad made me solve the problem!
 
V

veko

Guest
Create an object called obj_normalspeed
Create event:
Code:
alarm[0] = 2;
Alarm 0 event:
Code:
room_speed = 30;
instance_destroy();
Change your collision code to:
Code:
if global.isDashing = true
{
room_speed = 10;
score++;
instance_create(x, y, obj_normalspeed);
instance_destroy();
}
Do this if you want to execute an alarm after destroying your object.
thank you very much for your help but that wasnt the problem, i already figured it out. awesome avatar btw!
 
Top