E
eggyeox
Guest
Hi! I'm an absolute beginner, I've never taken a course or anything, I've been playing around with Gamemaker Studio 2, using tutorials, etc. In the intro of my game, I have a room with an object that, when I press space, creates an instance with my fade in/out object, which switches to the next room. When it's fading and space is pressed again, it starts fading again and skips to the room after. It works perfectly when you just press space once, but if a player mashes the space bar while trying to skip the intro, it glitches and skips the Start screen, so is there a way to prevent the new instance to be created while it fades and the space bar is pressed again?
The object in my first room just has the Create Instance event, which creates the fade in/out object.
As for the fade in/out object I'm using the following codes:
Create:
Draw:
That's all, thank you!
The object in my first room just has the Create Instance event, which creates the fade in/out object.
As for the fade in/out object I'm using the following codes:
Create:
Code:
al = 0; fade1 = 1; depth = -9
Code:
al = clamp(al + (fade1 * 0.05),0,1);
if (al == 1)
{
room_goto_next();
fade1 = -1;
}
if (al == 0) && (fade1 == -1)
{
instance_destroy();
}
draw_set_color(c_black);
draw_set_alpha(al);
draw_rectangle(
view_xport[0],
view_yport[0],
view_xport[0] + view_wport[0],
view_yport[0] + view_hport[0],
0
)
draw_set_alpha(1);