Scrabble: Panel tiles to show letter and change color when clicked C#

help me

Hey all, just got into Godot and C# coming from years of Python/Java/CPP, and have been messing around with making a basic Scrabble to learn the ropes. All I want to do is let the player write a word using the tiles they're given. So far, I have the following:

(Note I'm using C#)

  1. I have a BoxContainer (The player's hand), and they have 7 instances of "LetterTile" in their hand.
  2. A "WordBuffer" which will create the word they are trying to write by appending letters as they click on tiles.
  3. A "Submit" button which will submit the WordBuffer's value to the dictionary API to check if the word is valid. If valid, the player is given WordBuffer.size number of new letters.
  4. A "Reset" button which will clear the WordBuffer and allow all the "used" tiles to be used again.

I'm trying to make the letters dynamically show their value (so when the player gets a new hand, I can update the new letters). I also want to make the color of the tiles change when they are clicked on, and sent to the WordBuffer in sequence:

public partial class LetterTile: Panel {
  private char letter = ''
  public override void _Ready()
  {
    // Update Panel's text to this.letter
  }
  public override void _Input(InputEvent @event){  // If the user clicks on the LetterTile
    // Change the background color of the tile
    // Send this.letter to WordBuffer
    // (Other logic to disable the tile until further notice)
  }
}

Posted Feb 22, 2025, 12:19 AM UTC

10

Comments aren't archived yet

Comments for this period haven't been loaded into the archive yet.