This commit is contained in:
SondreElg
2025-10-05 14:47:13 +02:00
parent feaf2b7289
commit e25a2eed60
3 changed files with 30 additions and 2 deletions

View File

@@ -10,6 +10,11 @@ enum MoveState {Still, Moving, Dashing, Knockback}
@onready var camera: Camera2D = %PlayerCamera
@onready var sprite: AnimatedSprite2D = $PlayerSprite
@onready var hand: Control = %Hand;
@onready var shield: Sprite2D = $Shield
@onready var score_counter: RichTextLabel = %ScoreCounter
var score = 0;
var high_score = 0;
var shield_active = true;
var move_direction = Vector2.ZERO;
@@ -117,6 +122,16 @@ func take_hit(_damage, knockback_vector, knockback_strength = 1):
else:
reboot();
func add_to_score(amount):
score += amount;
if score > high_score:
high_score = score;
score_counter.text = "Score: %d\nHigh Score: %d" % [score, high_score]
func reset_score():
score = 0;
score_counter.text = "Score: %d\nHigh Score: %d" % [score, high_score]
func reboot():
# Called when the player dies
# For now, just reset position and state
@@ -124,4 +139,5 @@ func reboot():
velocity = Vector2.ZERO;
move_state = MoveState.Still;
shield_active = true;
reset_score();
# hand.discard_all();