F
Fatality
Guest
Recently I've been working on a top down game and ive moved into working on screen transitions for my main way of moving between areas. I have figured a few parts out with the help of some YouTube videos and understand decent amounts of coding and have been using an enum with constants of an intro which draws a visual transition, a constant that moves me to the next room, and a constant that brings me to a specified room. former being the intro works properly but I'm having trouble with the latter. when using goto it gives me no errors, although I know it interacted due to the loss of movement as specified in my coding. My other problem originates in my next which allows me to move from the first to the second room but does not let me move to the third giving me a fatal error with not much description as far as I can tell
////oTransition
/// @desc Size variables and mode setup
w = display_get_gui_width();
h = display_get_gui_height();
h_half = h * 0.5;
enum TRANS_MODE
{
OFF,
Next,
GOTO,
RESTART,
INTRO
}
mode = TRANS_MODE.INTRO;
percent = 1.2;
target = room;
/// @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(1.2,percent + min(((1.2 - percent)/10),0.005));
}
if (percent == 1.2 || (percent == 0)
{
switch (mode)
{
case TRANS_MODE.INTRO:
{
mode = TRANAS_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;
}
}
}
}
/// @desc Draw black bars
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);
}
draw_set_color(c_white);
draw_text(50,50,string(percent));
////SlideTransition
/// @desc SlideTransition(mode, targetroom)
/// @arg mode sets transition mode between next, restart and goto
/// @arg Target sets target room when using the goto mode
with (oTransition)
{
mode = argument[0];
if (argument_count > 1) taget = argument[1];
}
////o player - Key press R
/// @desc Restart
SlideTransition(TRANS_MODE.RESTART)
//// oAreaMovement
/// @desc Move to next room
with (oPlayer)
{
if (hascontrol)
{
hascontrol = false;
***SlideTransition(TRANS_MODE.NEXT,other.target);
}
}
ive also tried this for direct movement
//// oAreaMovement
/// @desc Move to next room
with (oPlayer)
{
if (hascontrol)
{
hascontrol = false;
***SlideTransition(TRANS_MODE.GOTO,other.target);
}
}
ive set the target inside the specific objects for GOTO
three stars represent the lines that Ive been having trouble with
////oTransition
/// @desc Size variables and mode setup
w = display_get_gui_width();
h = display_get_gui_height();
h_half = h * 0.5;
enum TRANS_MODE
{
OFF,
Next,
GOTO,
RESTART,
INTRO
}
mode = TRANS_MODE.INTRO;
percent = 1.2;
target = room;
/// @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(1.2,percent + min(((1.2 - percent)/10),0.005));
}
if (percent == 1.2 || (percent == 0)
{
switch (mode)
{
case TRANS_MODE.INTRO:
{
mode = TRANAS_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;
}
}
}
}
/// @desc Draw black bars
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);
}
draw_set_color(c_white);
draw_text(50,50,string(percent));
////SlideTransition
/// @desc SlideTransition(mode, targetroom)
/// @arg mode sets transition mode between next, restart and goto
/// @arg Target sets target room when using the goto mode
with (oTransition)
{
mode = argument[0];
if (argument_count > 1) taget = argument[1];
}
////o player - Key press R
/// @desc Restart
SlideTransition(TRANS_MODE.RESTART)
//// oAreaMovement
/// @desc Move to next room
with (oPlayer)
{
if (hascontrol)
{
hascontrol = false;
***SlideTransition(TRANS_MODE.NEXT,other.target);
}
}
ive also tried this for direct movement
//// oAreaMovement
/// @desc Move to next room
with (oPlayer)
{
if (hascontrol)
{
hascontrol = false;
***SlideTransition(TRANS_MODE.GOTO,other.target);
}
}
ive set the target inside the specific objects for GOTO
three stars represent the lines that Ive been having trouble with