0 votes

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

https://prnt.sc/1yhz3cn
https://prnt.sc/1yhza01
here is the code:

ffunc updatecounter():
current
counter -= 1
emitsignal("setcounterinfo", currentcounter)
if currentcounter <= 0:
current
counter = 0
game_over()

func gameover():
if current
counter == 0 and boardstable:
you
lose = true
emitsignal("gamelost")
prints("youlose" , youlose)

func ongridupdatecounter():
if ismoves:
update
counter()

  • the last function is ongridcounter() is connected thru signal from another .gd file.
    func after
    refill():
    for i in width:
    for j in height:
    if allpieces[i][j] != null:
    if match
    at(i, j, allpieces[i][j].color) or allpieces[i][j].matched:
    findmatches()
    get
    parent().getnode("destroytimer").start()
    return
    if !damagedslime:
    generate
    slime()
    streak = 1
    movechecked = false
    damaged
    slime = false
    colorbombused = false
    if isdeadlocked():
    $ShuffleTimer.start()
    can
    move = true
    matchfound = false
    emit
    signal("changemovestate")
    emitsignal("updatecounter") << the emition of signal
    $HintTimer.start()
Godot version Godot 3.3
in Engine by (14 points)
edited by

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

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

1 Answer

0 votes

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.

by (72 points)

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

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 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 webmaster@godotengine.org with your username.