Refine combo charge controls
This commit is contained in:
@@ -35,7 +35,10 @@ func _init() -> void:
|
||||
_expect_warrior_animation(animation_player, "warrior_aa", 11, 5)
|
||||
_expect_warrior_animation(animation_player, "warrior_aaa", 12, 8)
|
||||
_expect_warrior_animation(animation_player, "warrior_s_projectile", 14, 13)
|
||||
_expect_warrior_animation(animation_player, "warrior_charge_release", 13, 16, WARRIOR_WOMAN_TEXTURE)
|
||||
_expect_warrior_animation(animation_player, "warrior_charge_intro", 13, 8, WARRIOR_WOMAN_TEXTURE)
|
||||
_expect_warrior_animation(animation_player, "warrior_charge_loop", 13, 4, WARRIOR_WOMAN_TEXTURE, 4)
|
||||
_expect_animation_loops(animation_player, "warrior_charge_loop")
|
||||
_expect_warrior_animation(animation_player, "warrior_charge_release", 13, 8, WARRIOR_WOMAN_TEXTURE, 8)
|
||||
_expect_warrior_animation(animation_player, "warrior_a_space_space", 15, 12)
|
||||
_expect_warrior_animation(animation_player, "warrior_a_space", 17, 10)
|
||||
_expect_charge_effect(player)
|
||||
@@ -46,7 +49,8 @@ func _init() -> void:
|
||||
failures.append("Old slash animation should be removed")
|
||||
|
||||
player.call("submit_combo_input", "W")
|
||||
_expect_string(str(player.get("last_requested_skill_id")), "", "W alone should not request a skill")
|
||||
_expect_string(str(player.get("last_requested_skill_id")), "skill_w", "W alone should request row 6 skill")
|
||||
_expect_string(str(player.get("current_skill_animation")), "warrior_w", "W alone should play warrior_w")
|
||||
player.call("submit_combo_input", "A")
|
||||
_expect_string(str(player.get("last_requested_skill_id")), "skill_wa", "W+A should request row 7 skill")
|
||||
_expect_string(str(player.get("current_skill_animation")), "warrior_wa", "W+A should play warrior_wa")
|
||||
@@ -71,7 +75,7 @@ func _expect_action_has_key(action_name: String, key: Key) -> void:
|
||||
failures.append("Input action %s should be bound to key %s" % [action_name, OS.get_keycode_string(key)])
|
||||
|
||||
|
||||
func _expect_warrior_animation(animation_player: AnimationPlayer, animation_name: String, row: int, expected_frames: int, texture_path := WARRIOR_TEXTURE) -> void:
|
||||
func _expect_warrior_animation(animation_player: AnimationPlayer, animation_name: String, row: int, expected_frames: int, texture_path := WARRIOR_TEXTURE, start_column := 0) -> void:
|
||||
if not animation_player.has_animation(animation_name):
|
||||
failures.append("Missing animation: %s" % animation_name)
|
||||
return
|
||||
@@ -106,7 +110,7 @@ func _expect_warrior_animation(animation_player: AnimationPlayer, animation_name
|
||||
failures.append("Missing vframes track: %s" % animation_name)
|
||||
if frame_values.size() != expected_frames:
|
||||
failures.append("%s should key %d frames, got %d" % [animation_name, expected_frames, frame_values.size()])
|
||||
var first_frame := (row - 1) * WARRIOR_COLUMNS
|
||||
var first_frame := (row - 1) * WARRIOR_COLUMNS + start_column
|
||||
for index: int in range(frame_values.size()):
|
||||
var expected := first_frame + index
|
||||
if frame_values[index] != expected:
|
||||
@@ -123,6 +127,15 @@ func _expect_string(actual: String, expected: String, label: String) -> void:
|
||||
failures.append("%s: expected %s, got %s" % [label, expected, actual])
|
||||
|
||||
|
||||
func _expect_animation_loops(animation_player: AnimationPlayer, animation_name: String) -> void:
|
||||
if not animation_player.has_animation(animation_name):
|
||||
failures.append("Missing animation for loop check: %s" % animation_name)
|
||||
return
|
||||
var animation: Animation = animation_player.get_animation(animation_name)
|
||||
if int(animation.loop_mode) != 1:
|
||||
failures.append("%s should loop, got loop_mode %d" % [animation_name, int(animation.loop_mode)])
|
||||
|
||||
|
||||
func _expect_projectile_animation(projectile: Node) -> void:
|
||||
if projectile.get_child_count() == 0:
|
||||
failures.append("Projectile should create a Sprite2D child")
|
||||
|
||||
Reference in New Issue
Block a user