I have a script containing the game's stats and an coin Area2D increasing one of the stats when collected. The problem is the coin count stat doesn't increase when the coin is collected.
The game stats:
class_name Stats
extends Resource
export(int, 0, 100) var coin_count
The coin Area2D:
extends Area2D
func _on_Coin_body_entered(body):
if body.name == "Player"
if stats.coin_count < 100 and visible:
stats.coin_count += 1
queue_free()
Some things I want to address:
1. The if conditions for the coin collection does work since the coin disappear when the Player enter the coin area
2. The stats' coin count still not change from the remote tab
3. For the coins, the coin counts do increase, but the script's stats don't as if it was unaffected. It's likely this part of code who is the culprit
var stats := Stats.new()