add player sounds

This commit is contained in:
Haze Weathers 2025-02-24 14:25:54 -05:00
parent 26deb746e7
commit 9fb4d38e05
2 changed files with 37 additions and 11 deletions

View file

@ -1,6 +1,12 @@
class_name Player
extends CharacterBody3D
signal bounced()
signal shot()
signal charge_canceled()
@export_group("Visuals")
@export var goal_animation_time: float = 1.0
@export var charge_gradient: Gradient
@ -96,6 +102,9 @@ func _end_charge() -> void:
velocity = -camera_z.normalized() * power * power_scale
prev_velocity = velocity
_bounce_on_walls(1.0/60.0)
shot.emit()
else:
charge_canceled.emit()
#endregion
@ -126,16 +135,7 @@ func _bounce_on_walls(delta: float = 0.0) -> void:
h_vel = h_vel.bounce(col.get_normal())
velocity.x = h_vel.x
velocity.z = h_vel.z
#var h_vel = (prev_velocity * Vector3(1.0, 0.0, 1.0))
#if not h_vel.is_zero_approx():
#wall_detector.look_at(wall_detector.global_position - h_vel)
#wall_detector.force_shapecast_update()
#if wall_detector.is_colliding():
#for i in wall_detector.get_collision_count():
#h_vel = h_vel.bounce(wall_detector.get_collision_normal(i))
#velocity.x = h_vel.x
#velocity.z = h_vel.z
bounced.emit()
#endregion