Godot Version
4.6
Question
Hello!!! SO i have a win condition to either win or lose if you have a certain score, but everytime i try to run it, I always lose, even when Im way above the score i said as what was needed. Im pretty sure this is because maybe the ‘score’ is only updating the label and isnt actually a number, but i dont know how to fix that. Any help would be appreciated. THanks!!
This is in my main node for the score:
var score = 0
func set_score(new_score: int) -> void:
score = new_score
score_label.text = "Score: " + str(score)
this is the label for the score:
extends Label
var score: int = 0:
set(value):
score = value
text = "Score: " + str(score)
example of how the score gets added, only one put in here because i have four different arrows for this rythm game, and theyre all the same. (which is changing my label to be +1 everytime but again, dont think its changing the actual number :,D)
func set_score(new_score: int) -> void:
score = new_score
score_label.text = "Score: " + str(score)
func _process(delta: float) -> void:
if body_entered != false:
if Input.is_action_just_pressed('left_arrow'):
score_label.score += 1
and heres what was supposed to work, but is only giving me losses:
func _process(delta: float) -> void:
if Globals.game_end:
if score > 29:
get_tree().change_scene_to_file("res://Scenes/office.tscn")
Globals.won = true
print("win!")
else:
get_tree().change_scene_to_file("res://Scenes/office.tscn")
print("lost :(")
