• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

TRANS.MODE.GOTO not working

L

Lerchprinz

Guest
hey, i am watching the Plattformer Tutorial from shaun and one thing never worked at my code...
The TRANS.MODE restart, next, intro etc. allways worked. except the GOTO event. when i make this the screen just gets black all the time. any ideas?

code:
Create:
Code:
/// @description 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;
target = room;
step:
Code:
/// @description 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 + max(((1.2 - percent)/10),0.005));
    }
}
if(percent == 1.2) || (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:
        {
            room_goto(target);
            break; 
        }
        case TRANS_MODE.RESTART:
        {
            game_restart();
            break; 
        }
    }
}

and here is my transition script
with(obj_transition){
mode = argument[0];
if(argument_count > 1) target = argument[1];

}

Thanks ;)
 
Last edited by a moderator:

chamaeleon

Member
hey, i am watching the Plattformer Tutorial from shaun and one thing never worked at my code...
The TRANS.MODE restart, next, intro etc. allways worked. except the GOTO event. when i make this the screen just gets black all the time. any ideas?

code:
Create:
Code:
/// @description 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;
target = room;
step:
Code:
/// @description 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 + max(((1.2 - percent)/10),0.005));
    }
}
if(percent == 1.2) || (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:
        {
            room_goto(target);
            break;
        }
        case TRANS_MODE.RESTART:
        {
            game_restart();
            break;
        }
    }
}

and here is my transition script
with(obj_transition){
mode = argument[0];
if(argument_count > 1) target = argument[1];

}

Thanks ;)
What has show_debug_message() or debugging told you about what pieces of code is executed, values of your variables and what the code path taken is when your game goes black? Of the top of my head I'd hazard a guess you're doing room_goto() over and over every step to the same room without any chance of getting out of the loop. But that's just a guess.
 
L

Lerchprinz

Guest
What has show_debug_message() or debugging told you about what pieces of code is executed, values of your variables and what the code path taken is when your game goes black? Of the top of my head I'd hazard a guess you're doing room_goto() over and over every step to the same room without any chance of getting out of the loop. But that's just a guess.
what is show_debug_message?
 
L

Lerchprinz

Guest
Hey, i was able to fix it. it was indeed a endless loop. But now when my character dies he just gets respawned at the place he died. room_restart() is not working... any other ideas?
 
Top