feat: add double-barrel shotgun weapon, player movement state machine, and procedural sound assets

This commit is contained in:
DottsGit
2026-06-04 16:40:15 -04:00
parent 13ca2f46e9
commit 67bd5b4302
18 changed files with 282 additions and 3 deletions
+4
View File
@@ -81,6 +81,8 @@ func update(delta: float) -> void:
machine.on_ground = false
machine.jump_buffer_time = 0.0
machine.register_chain_mechanic("bunny_hop")
if player.jump_player:
player.jump_player.play()
# Stay in air state
return
@@ -92,6 +94,8 @@ func update(delta: float) -> void:
player.velocity.y = params.double_jump_velocity
machine.current_jump_count += 1
machine.register_chain_mechanic("double_jump")
if player.double_jump_player:
player.double_jump_player.play()
return
# ── Wall run transition ───────────────────────────────────────────────
+4
View File
@@ -24,6 +24,10 @@ func enter(_data: Dictionary = {}) -> void:
elapsed = 0.0
_last_dash_time = now
var player := machine.player
if player.dash_player:
player.dash_player.play()
# Direction: use wish direction if available, else player forward
var wish := machine.wish_dir_world
if wish.length_squared() > 0.01:
+15
View File
@@ -5,6 +5,7 @@ var machine: MovementStateMachine
var params: MovementParams:
get: return machine.params
var _footstep_timer: float = 0.0
func enter(_data: Dictionary = {}) -> void:
machine.on_ground = true
@@ -33,6 +34,8 @@ func update(delta: float) -> void:
machine.on_ground = false
machine.coyote_timer = 0.0
machine.register_chain_mechanic("jump")
if player.jump_player:
player.jump_player.play()
machine.switch_to("air")
return
@@ -43,6 +46,8 @@ func update(delta: float) -> void:
machine.on_ground = false
machine.jump_buffer_time = 0.0
machine.register_chain_mechanic("jump")
if player.jump_player:
player.jump_player.play()
machine.switch_to("air")
return
@@ -86,6 +91,16 @@ func update(delta: float) -> void:
_update_capsule_height()
var current_hspeed = Vector2(player.velocity.x, player.velocity.z).length()
if current_hspeed > 1.0:
_footstep_timer -= delta
if _footstep_timer <= 0.0:
if player.footstep_player:
player.footstep_player.play()
_footstep_timer = max(0.2, 3.0 / current_hspeed)
else:
_footstep_timer = 0.0
# ── Update ground status ──────────────────────────────────────────────
if player.is_on_floor():
machine.on_ground = true
+11
View File
@@ -14,6 +14,9 @@ func enter(_data: Dictionary = {}) -> void:
elapsed = 0.0
machine.register_chain_mechanic("slide")
if machine.player.slide_player and not machine.player.slide_player.playing:
machine.player.slide_player.play()
# Save original capsule height and halve it
var shape: CapsuleShape3D = _get_capsule()
if shape:
@@ -38,6 +41,10 @@ func enter(_data: Dictionary = {}) -> void:
func exit() -> void:
machine.slide_cooldown_timer = params.slide_cooldown
if machine.player.slide_player:
machine.player.slide_player.stop()
# Restore original capsule height
var shape: CapsuleShape3D = _get_capsule()
if shape and _saved_capsule_height > 0.0:
@@ -47,6 +54,10 @@ func exit() -> void:
func update(delta: float) -> void:
elapsed += delta
var player := machine.player
if player.slide_player and not player.slide_player.playing:
player.slide_player.play()
var vel: Vector3 = player.velocity
# ── Apply friction to horizontal velocity ─────────────────────────────
+9
View File
@@ -22,6 +22,9 @@ func enter(_data: Dictionary = {}) -> void:
machine.on_ground = false
_last_vel = machine.player.velocity
if machine.player.wallrun_player and not machine.player.wallrun_player.playing:
machine.player.wallrun_player.play()
var hvel := Vector3(machine.player.velocity.x, 0.0, machine.player.velocity.z)
_current_tangent = machine.wall_normal.cross(Vector3.UP).normalized()
if hvel.dot(_current_tangent) < 0.0:
@@ -43,6 +46,9 @@ func exit() -> void:
var rig = _get_camera_rig()
if rig:
rig.clear_wall_tilt()
if machine.player.wallrun_player:
machine.player.wallrun_player.stop()
func update(delta: float) -> void:
@@ -57,6 +63,9 @@ func update(delta: float) -> void:
var player := machine.player
var vel: Vector3 = player.velocity
if player.wallrun_player and not player.wallrun_player.playing:
player.wallrun_player.play()
if vel.distance_squared_to(_last_vel) > 100.0:
machine.wall_normal = Vector3.ZERO
machine.wall_side = 0.0