![]() |
Attention | Topic was automatically imported from the old Question2Answer platform. |
![]() |
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 is the code:
ffunc update_counter():
current_counter -= 1
emit_signal(“set_counter_info”, current_counter)
if current_counter <= 0:
current_counter = 0
game_over()
func game_over():
if current_counter == 0 and board_stable:
you_lose = true
emit_signal(“game_lost”)
prints(“you_lose” , you_lose)
func _on_grid_update_counter():
if is_moves:
update_counter()
- 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:
find_matches()
get_parent().get_node(“destroy_timer”).start()
return
if !damaged_slime:
generate_slime()
streak = 1
move_checked = false
damaged_slime = false
color_bomb_used = false
if is_deadlocked():
$ShuffleTimer.start()
can_move = true
match_found = false
emit_signal(“change_move_state”)
emit_signal(“update_counter”) << the emition of signal
$HintTimer.start()
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