add player stats and camera shaking on damage

This commit is contained in:
2025-07-04 06:32:13 +10:00
parent 6df3d1a2dd
commit e61c7d0e95
5 changed files with 52 additions and 4 deletions

View File

@@ -43,9 +43,7 @@ func _physics_process(delta: float) -> void:
var speed_squash := clampf(
_velocity.length() / _speed_stretch_factor, 0, MAX_STRETCH
)
_model_base.scale = Vector3(
1 - speed_squash, 1 - speed_squash, 1 + speed_squash
)
_model_base.scale = Vector3(1 - speed_squash, 1 - speed_squash, 1 + speed_squash)
func init(velocity: Vector3, start_position: Vector3, lifetime: float = 10) -> void:
@@ -62,6 +60,8 @@ func set_velocity(velocity: Vector3) -> void:
func _on_body_entered(node: Node3D) -> void:
if node is Player:
queue_free()
var player := node as Player
player.stats.damage()
return
if node is CollisionObject3D: