#Help Needed: My Script Isn’t Working – Coin Pickup Doesn’t Add to Label or Start the Game

6 messages · Page 1 of 1 (latest)

bold dew
#

func _process(delta):
$CoinUI/Coin/Label.text = str(coins)

#

Can someone please help me?

cursive ether
#

this is only the part of the code that sets the text of the lable to the ammount of coins. How does the coins-variable get increased?

bold dew
#

extends Area2D

func _on_body_entered(body):
if body.is_in_group("Players"):
$AnimatedSprite2D.play("Collected")
await $AnimatedSprite2D.animation_finished
GameManager.coins += 1
queue_free()

bold dew
#

and this is my gamemanager extends Node

var coins = 0
var score = 0

func _process(delta):
pass