In my game, if the player goes through a door, I would like to have text appear for one second and then fade out.
I'm using GameMaker:Studio 1.4
In my game, if the player goes through a door, I would like to have text appear for one second and then fade out.
I'm using GameMaker:Studio 1.4
Create event:
count = 0
alpha = 1
delay = 1 // in seconds
Step event:
if (count == room_speed * delay) {
alpha -= 0.05
draw_set_alpha(alpha)
if (image_alpha <= 0) {
instance_destroy();
}
}
else {
count += 1
}
draw_text(x, y, "You went through a door")
draw_set_alpha(1);
When the player goes through the door you simply use
instance_create( x, y, obj_text)
to display the text.
You can change the value of delay to define how long the text should be shown until it starts to fade out.
Create an object, for example
obj_text
, with the following events:Create event:
Alarm 0 event:
Step event:
Draw event:
When the player goes through a door, simply use
instance_create(x, y, obj_text)
to display the text.