Created
May 27, 2019 18:41
-
-
Save pixelage/e044a9812436ffb2652d352e09c4b26e to your computer and use it in GitHub Desktop.
[Room Transition]
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// @desc slide_transition(mode, targetroom) | |
/// @arg mode sets transition mode between next, restart and goto. | |
/// @arg targetroom sets target room when using the goto mode | |
with (oTransition) | |
{ | |
mode = argument[0]; | |
if (argument_count > 1) target = argument[1]; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// @desc Size variables and mode setup | |
w = display_get_gui_width(); | |
h = display_get_gui_height(); | |
h_half = h / 2; | |
enum TRANS_MODE | |
{ | |
OFF, | |
NEXT, | |
GOTO, | |
RESTART, | |
INTRO | |
} | |
mode = TRANS_MODE.INTRO; | |
percent = 1; | |
target = room; | |
targetpercent = 1.5; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// @desc Black Slides | |
if (mode != TRANS_MODE.OFF) | |
{ | |
draw_set_color(c_black); | |
draw_rectangle(0, 0, w, percent*h_half, false); | |
draw_rectangle(0, h, w, h-(percent*h_half), false); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
slide_transitions(TRANS_MODE.RESTART); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// @desc Progress the Transition | |
if (mode != TRANS_MODE.OFF) | |
{ | |
if (mode == TRANS_MODE.INTRO) | |
{ | |
percent = max(0, percent - max((percent/10), 0.005)); | |
} | |
else | |
{ | |
percent = min(targetpercent, percent + max(((targetpercent - percent)/10), 0.005)); | |
} | |
if (percent == targetpercent) || (percent == 0) | |
{ | |
switch (mode) | |
{ | |
case TRANS_MODE.INTRO: | |
{ | |
mode = TRANS_MODE.OFF; | |
break; | |
} | |
case TRANS_MODE.NEXT: | |
{ | |
mode = TRANS_MODE.INTRO; | |
room_goto_next(); | |
break; | |
} | |
case TRANS_MODE.GOTO: | |
{ | |
mode = TRANS_MODE.INTRO; | |
room_goto(target); | |
break; | |
} | |
case TRANS_MODE.RESTART: | |
{ | |
game_restart(); | |
break; | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment