Godot 4.3 (steam)
I was following a tutorial from youtube on how to make a stamina bar for mi character. when I finished and tried to run the scene it will close and will give me the error on the topic name, I tried tweaking everything but its always the same “Invalid access to property or key ‘value’ on a base object of type ‘int’.”
Here is the code, error is in line 14:
extends Control
@onready var stamina = $TextureProgressBar
@export var can_regen: = false
@export var time_to_wait = 1.5
@export var s_timer = 0
@export var can_start_stimer = true
# Called when the node enters the scene tree for the first time.
func _ready():
stamina = 100
# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta) :
#stamina regen
if can_regen == false && stamina.value != 100 or stamina.value == 0:
can_start_stimer = true
if can_start_stimer:
s_timer += delta
if s_timer >= time_to_wait:
can_regen = true
can_start_stimer = false
s_timer = 0
if stamina.value == 100:
can_regen = false
if can_regen == true:
stamina.value += 0.5
can_start_stimer = false
s_timer = 0
Could not figure how to fix it