#Looking for Best Way to Approach Recreating This Simple Minigame

4 messages · Page 1 of 1 (latest)

ancient pelican
#

Hello. I'm quite new to Godot and am attempting to recreate an escape room from the game Nine Hours, Nine Persons, Nine Doors. Part of that includes this puzzle minigame.

To complete it, one must select three cards from the bottom screen to produce a particular digital root. The top screen displays your selected cards and what they produce. I'm wondering how I should approach this.

For the top screen, I'm thinking of using an HBoxContainer with three TextureRects whose textures get replaced when a card is selected.

For the bottom screen, I'm thinking of using a GridContainer with six TextureButtons which can be toggled. I can create separate toggle sensors for all six of them, but I'm unsure if that's the cleanest solution. What if a minigame had 20 buttons? Would I need to create a separate sensor for each of them too? I figure, there's probably a better way.

Just curious and looking to pick up on best practices. I hope you don't mind if this is really simple.

#

The screenshot is taken from a YouTube video of the original Nintendo DS game

#

I'm not looking for code to produce digital roots or anything like that by the way. Just the basic setup I should use for the nodes and how I would integrate button input into the scene control script without writing a bunch of almost identical sensors

ancient pelican
#

I may have found something! Connecting signals seems promising:

func _ready():
    # Connects all card button toggles
    for button in get_tree().get_nodes_in_group("card_buttons"):
        button.connect("pressed", _card_pressed.bind(button))

# Called when any card is pressed
func _card_pressed(button):
    # Stuff happens here

Would you say that this is a perfectly good solution?