Hi, I'm encountering a very strange bug.
I am able to collect coins to increase my score from 0 to 1, but once it hits 1, I cannot increase my score normally.
if I disable the "taken" function, I am able to increase more score by more than 1 but hitting the same coin several times. But as soon as I hit a second new coin, the score goes back to 1.
I don't know how to fix this. I want to be able to continuously increase my score.
Some things I did earlier:
I inherited level one to make level two. I did the same with the loosing screen to create the winning screen.
Just a warning, the code isn't very clean. The game is 12 MB. It's the game I'm working on is available here: https://drive.google.com/drive/folders/1DcrBne447Yyf-DtT05bYVfN4kJ208g0v?usp=sharing
var taken = false #if coin has been touched, it cannot be recollected again glitch fix
func _on_Area2D_body_entered(body):
# if not taken: #if coin has been touched, it cannot be recollected again glitch fix
# taken = true #if coin has been touched, it cannot be recollected again glitch fix
if body.name == "Bunny1":
$AnimationPlayer.play("collected")
$AudioStreamPlayer_coin.play()
coin_collected7 = 1 + coin_collected7
update_GUI_for_coins()
update_for_new_victory_screen()
func update_GUI_for_coins():
get_tree().call_group("GUI_CanvasLayer","update_coins",coin_collected7)
func update_for_new_victory_screen():
get_tree().call_group("Bunny","hidden_coins", coin_collected7)
func coin_deletion():
queue_free()
Thank you for your time