• 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!

Inputting Methods Into Scripts

C

Cofefe

Guest
Hello forums! Long time no see.

I have a quick question that I need answered, and I know somebody here can do it for me. The question is: Is it possible to input method variables into script functions? Here's an example of what I'm trying to do, but which doesn't work:

GML:
// Step Event:

Test = function() {
    game_restart();
}

switch(move_state) {
    case STATE.NORMAL:
    move_standard(_left, _right, _acc, _fric, _max_speed, _max_slope, _grav, _max_fall, Test);
    move_jump(SOURCE.KEYBOARD, vk_space, true, 12, 3, 10);
    break;
}

/// move_standard Script Function:
function move_standard(_left, _right, _acc, _fric, _max_speed, _max_slope, _grav, _max_fall, _stuck_action) {
    
    #region Resolve Platform Collisions
    if(collision_check(x, y)) _stuck_action;        //Execute the inputted method
    #endregion
}
If there is a way to do this, that would be immensely helpful going forward when it comes to creating more modular code.

Thanks for any replies!
 
C

Cofefe

Guest
Ohhh, of course! LOL! Now I feel dumb. Well, it works and that is phenomenal, thank you!
 
Top