How to show choice in Game maker with gamepad functionality

839 views Asked by At

I am working on a Dragon Warrior - type rpg game in Game Maker studio and can't figure out how to get a show choice option that doesn't use the mouse. I have setup the game to run completely with a gamepad, but when I am confronted with the situation that requires feedback (choice selection) from the player I am unable to get the gamepad working. Heres the GML

if (distance_to_object(obj_judy)) <= 64 {
    if keyboard_check(vk_space) || gamepad_button_check_pressed(0, gp_face3) {
        show_question(mine_crystal);
        if true {
            global.energy -= 10;
            global.power_crystal += 1;
            instance_destroy();
        }
    }
}

The problem is " show_question(); " uses a windows-type popup and doesn't work with the gamepad.

How do I get feedback from the player using only inputs from the gamepad? Thanks for your time reading and your help with this small issue.

1

There are 1 answers

0
Rob On

So yeah, you'll need to write that logic yourself. Also, that code you wrote there looks kinda scary, i'd use this;

    if (show_question(mine_crystal) == true) {
        global.energy -= 10;
        global.power_crystal += 1;
        instance_destroy();
    }

because

show_question(mine_crystal);
if true {
    global.energy -= 10;
    global.power_crystal += 1;
    instance_destroy();
}

Will show a question, and then always do the mine crystal action (because your if (true) will always evaluate to true, it doesn't know about the line above