I need help with my code.

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By jenza

Hey, guys. I’ll just have to ask for help with this. As you can see on the screenshot I can still play even if the counter is less than 0 already and the game over window didn’t show up. Also there are times that the Victory Window appears twice when the game is won. I hope you can help me with this. Thank you ahead. here's the code which I think is responsible for it

here is the code:

ffunc update_counter():
current_counter -= 1
emit_signal(“set_counter_info”, current_counter)
if current_counter <= 0:
current_counter = 0

func game_over():
if current_counter == 0 and board_stable:
you_lose = true
prints(“you_lose” , you_lose)

func _on_grid_update_counter():
if is_moves:

  • the last function is _on_grid_counter() is connected thru signal from another .gd file.
    func after_refill():
    for i in width:
    for j in height:
    if all_pieces[i][j] != null:
    if match_at(i, j, all_pieces[i][j].color) or all_pieces[i][j].matched:
    if !damaged_slime:
    streak = 1
    move_checked = false
    damaged_slime = false
    color_bomb_used = false
    if is_deadlocked():
    can_move = true
    match_found = false
    emit_signal(“update_counter”) << the emition of signal

Please properly copy, paste, and markdown your code (use the formatting buttons to help you).

Ertain | 2021-11-06 18:33

Thank you for the interest of helping me. I have pasted the codes already in case you want to take a look. Thanks again.

jenza | 2021-11-08 08:23

:bust_in_silhouette: Reply From: Shazelz

The only thing I could say without a copy of your code, not just a picture is that board_stable is never assigned to true which makes you_lose never be set to true through the if statement.

If that does not work or you do not know why that is happening please copy and paste all of the code that has a problem here or into something like https://pastebin.com/ so that we could help you further.

I get what you mean. I will try if this works. Thank you.

jenza | 2021-11-08 08:24