[Solved] How to Change movement speed and return to default?

C

CodeCabbage

Guest
Hi, Good day!

scenario: obj_player collides with obj_slow
intended effect: destroy obj_slow, then reduce obj_player move speed and return to normal(default set) move speed after about 3 sec.

i have set obj_player move speed to 2 in the create event.
i want to set an alarm in which it will return the move speed to 2 after 3 seconds.

any suggestions? thank you!
 

TheBroman90

Member
Alarm0 in obj_player:
Code:
move_speed = 2;
In obj_player's Collision Event with obj_slow:
Code:
alarm[0] = 3*room_speed;
move_speed = 1;
with(other) instance_destroy();
 
C

CodeCabbage

Guest
Alarm0 in obj_player:
Code:
move_speed = 2;
In obj_player's Collision Event with obj_slow:
Code:
alarm[0] = 3*room_speed;
move_speed = 1;
with(other) instance_destroy();
Thank you sir! it worked, i just fixed some glitch in my movement and adjusted my alarm[0] to
Code:
if move = 0 {
movespeed = 2;
}
else {alarm[0] = 1}
with this, i can add more movement modifications. Cheers!
 
I always store my starting values in separate 'default' variables or something like that:
Create Event
Code:
move_speed = 2;
move_speed_def = 2;
That way you can always reset the changes you've made (i.e. if a buff runs out or something).
 
C

CodeCabbage

Guest
I always store my starting values in separate 'default' variables or something like that:
Create Event
Code:
move_speed = 2;
move_speed_def = 2;
That way you can always reset the changes you've made (i.e. if a buff runs out or something).
Thank you! any advice helps a lot in my improvement. Cheers!
 
Top