referencing dictionary with a variable

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By cocopioche

export (int) var life
export (String) var ressource
var inventory = Gamemanager.inventorie

func _physics_process(delta: float) → void:


func die():
if life <= 0:
inventory.ressource += 1

it give thir error Invalid get index ‘ressource’ (on base: ‘Node2D (’).

:bust_in_silhouette: Reply From: magicalogic

Your inventory has no attribute ressource so just add it.

I found the answer I needed to do this

cocopioche | 2021-05-21 12:50