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

[SOLVED] Iterating skips steps (GML)

TheJoe

Member
Hi friends,

I know I'm doing something like a real bonehead but no matter what I try I can't figure this thing out. I'm trying to make a sequence of things happen (I know I know, but I'm at the 99% mark of this game so no switching to new GM versions for me). I want to point arrows at various things and when I press enter from my tutorial step 1 (t_step == 1), it skips to t_step == 3. At this point I have tried everything I can think of as far as scope or order of code block goes, nested code blocks - I can't get this thing. Not surprising as I have no coding background but I'd love some help if anyone has the time.

GML:
//If we're on tutorial step 1, create arrow and textbox
if t_step == 1
{
    if !instance_exists(o_arrow)
    {
        var arrow = instance_create_layer(220, 180, "Instances", o_arrow);
        with (arrow)
        {
            image_angle = point_direction(o_player.x,o_player.y,x,y) + 90;   
        }
    }
    
    if !instance_exists(o_nineslice)
    {
        var tut1 = instance_create_layer(300, 100, "Instances", o_nineslice);
        with (tut1)
        {
            text = "This is you both!";   
        }
    }

    //if you've read the textbox, press enter to move on
    if keyboard_check_pressed(vk_enter) and instance_exists(o_arrow) and instance_exists(o_nineslice)
    {
        instance_destroy(o_arrow);
        instance_destroy(o_nineslice);
        t_step++;
    }
}

if t_step == 2
{
    if !instance_exists(o_arrow)
    {
        var arrow = instance_create_layer(700, 180, "Instances", o_arrow);
        with (arrow)
        {
            image_angle = point_direction(o_leo.x,o_leo.y,x,y) + 90;   
        }
    }
    
    if !instance_exists(o_nineslice)
    {
        var tut1 = instance_create_layer(300, 100, "Instances", o_nineslice);
        with (tut1)
        {
            text = "This is Leo!";   
        }
    }
    
    if keyboard_check_pressed(vk_enter) and instance_exists(o_arrow) and instance_exists(o_nineslice)
    {
        instance_destroy(o_arrow);
        instance_destroy(o_nineslice);
        t_step++;
    }
}
 
Top