gover man!
This commit is contained in:
parent
55059788b2
commit
81b01b7508
8 changed files with 185 additions and 36 deletions
|
|
@ -7,23 +7,24 @@ extends CharacterBody2D
|
|||
@export var move_focused_speed: float
|
||||
@onready var startpos = position
|
||||
|
||||
var can_die = true
|
||||
|
||||
var focused: bool:
|
||||
get(): return Input.is_action_pressed(&"focus")
|
||||
|
||||
|
||||
func _physics_process(delta: float) -> void:
|
||||
var input_dir = Input.get_vector(&"move_left", &"move_right", &"move_up", &"move_down").sign()
|
||||
|
||||
velocity = input_dir.normalized() * (move_focused_speed if focused else move_normal_speed)
|
||||
move_and_slide()
|
||||
|
||||
|
||||
func _on_hurtbox_area_entered(area: Area2D) -> void:
|
||||
%DeathSound.play()
|
||||
position = startpos
|
||||
CurrentGame.change_lives(-1)
|
||||
if CurrentGame.lives < 0:
|
||||
gover()
|
||||
if can_die:
|
||||
%DeathSound.play()
|
||||
position = startpos
|
||||
CurrentGame.change_lives(-1)
|
||||
can_die = false
|
||||
|
||||
func gover():
|
||||
print("yeeeowtch!!!")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue