This site is currently in read-only mode during migration to a new platform.
You cannot post questions, answers or comments, as they would be lost during the migration otherwise.
0 votes

I.e. when the e in "real" it's clicked, a and l also have to return to the letterbox along with e letter.

func _ready():
    for i in range(4):
        for j in range(4):
            var tile:LetterTile = Letter.instance()
            # warning-ignore:return_value_discarded
            tile.connect("tile_clicked", self, "on_tile_clicked", [tile])
            tile.position = Vector2(i * TILESIZE, j * TILESIZE)
            tile.box_position = tile.position

func on_tile_clicked(tile:LetterTile):
    var start_pos = tile.global_position
    if tile.get_parent().name == "LetterBox":
        if word_node_erased == true:
            word_node_erased = false
        tile.global_position = start_pos
        current_word += tile.letter_value
        #This part i mean.
        var tile_position = tile.get_position_in_parent()
        $Tween.interpolate_property(tile,"position", start_pos - $LetterBox.position, tile.box_position,0.2,Tween.TRANS_LINEAR)
        current_word = current_word.substr(0, tile_position) + current_word.substr(tile_position + 1, current_word.length())

enter image description here

in Engine by (122 points)

1 Answer

0 votes
Best answer

I changed the code in my original Github repository. Here's what you would need to change in your code:

I basically moved the removal code in an own function, which is called not only for the clicked letter, but for all following letters as well.

by (1,762 points)
selected by
Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.