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
On
Create an object, for example obj_text, with the following events:
Create event:
alpha = 1;
fade_out = false;
alarm[0] = 60; // Time in frames
Alarm 0 event:
fade_out = true;
Step event:
if (fade_out) {
alpha -= 0.05;
}
if (alpha <= 0) {
instance_destroy();
}
Draw event:
draw_set_alpha(alpha);
draw_text(x, y, "You went through a door");
draw_set_alpha(1);
When the player goes through a door, simply use instance_create(x, y, obj_text) to display the text.
Create event:
Step event:
When the player goes through the door you simply use
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.