leg jump swap ani fix
This commit is contained in:
@@ -33,6 +33,7 @@ func run_all() -> void:
|
||||
var tests := [
|
||||
"test_states_register_and_initialize",
|
||||
"test_do_jump_sets_velocity_and_counters",
|
||||
"test_held_jump_bunny_hops_emit_each_takeoff",
|
||||
"test_double_jump_emits_jet_event",
|
||||
"test_wall_run_preserves_fast_entry_speed",
|
||||
"test_wall_run_entry_keeps_some_upward_momentum",
|
||||
@@ -129,6 +130,40 @@ func test_do_jump_sets_velocity_and_counters() -> void:
|
||||
_expect(not sm.on_ground, "no longer grounded")
|
||||
|
||||
|
||||
func test_held_jump_bunny_hops_emit_each_takeoff() -> void:
|
||||
var jump_events: Array[String] = []
|
||||
var controller := PlayerMovementController.new()
|
||||
controller._machine = sm
|
||||
sm.movement_event.connect(func(event_name: String, data: Dictionary) -> void:
|
||||
if event_name == "jump":
|
||||
jump_events.append(String(data.get("kind", "jump")))
|
||||
controller._on_movement_event(event_name, data)
|
||||
)
|
||||
var air = sm.states["air"]
|
||||
sm.input_jump_pressed = true
|
||||
fake_player.velocity = Vector3(0.0, 0.0, -params.walk_speed)
|
||||
var variants: Array[String] = []
|
||||
|
||||
# Start with an ordinary ground jump, then keep Space held through three
|
||||
# direct Air -> Air bunny hops. No intervening motion state is involved.
|
||||
sm.do_jump()
|
||||
variants.append(controller._visual_animation_state("air", params.walk_speed))
|
||||
for hop in 3:
|
||||
sm.jump_cooldown_timer = 0.0
|
||||
sm.notify_landed(0.0)
|
||||
_expect(air._try_bunny_hop(),
|
||||
"held jump starts bunny hop %d" % (hop + 1))
|
||||
variants.append(controller._visual_animation_state(
|
||||
"air", params.walk_speed))
|
||||
|
||||
_eq(jump_events, ["jump", "bunny_hop", "bunny_hop", "bunny_hop"],
|
||||
"every held-space bunny hop emits a jump takeoff")
|
||||
_eq(variants, ["air_alt", "air", "air_alt", "air"],
|
||||
"ground jump and consecutive bunny hops alternate leg variants")
|
||||
controller._machine = null
|
||||
controller.free()
|
||||
|
||||
|
||||
func test_double_jump_emits_jet_event() -> void:
|
||||
var events := []
|
||||
sm.movement_event.connect(func(ev, data): events.append([ev, data]))
|
||||
|
||||
Reference in New Issue
Block a user