M1d: Stilproben #12
@@ -440,7 +440,9 @@ func _shadow_image(width: int) -> Pixels:
|
|||||||
func _figure_image(colour: int, frame: int, left: bool) -> Pixels:
|
func _figure_image(colour: int, frame: int, left: bool) -> Pixels:
|
||||||
var pixels := Pixels.new(FIGURE_SIZE.x, FIGURE_SIZE.y)
|
var pixels := Pixels.new(FIGURE_SIZE.x, FIGURE_SIZE.y)
|
||||||
var shirt := players[colour]
|
var shirt := players[colour]
|
||||||
var bob := -1 if frame == 2 or frame == 4 else 0
|
# The body sinks a pixel while the legs are apart, so the head always keeps
|
||||||
|
# a free row above it for its outline.
|
||||||
|
var bob := 1 if frame == 1 or frame == 3 else 0
|
||||||
# The far leg and the near leg, by frame.
|
# The far leg and the near leg, by frame.
|
||||||
var legs: Array[Vector2i] = [Vector2i(6, 9), Vector2i(5, 10), Vector2i(7, 8), Vector2i(10, 5), Vector2i(8, 7)]
|
var legs: Array[Vector2i] = [Vector2i(6, 9), Vector2i(5, 10), Vector2i(7, 8), Vector2i(10, 5), Vector2i(8, 7)]
|
||||||
for leg in 2:
|
for leg in 2:
|
||||||
|
|||||||
@@ -79,3 +79,12 @@ func test_a_figure_walks_in_four_steps_and_faces_both_ways() -> void:
|
|||||||
check_eq(left.get_data(), frames[1], "facing left mirrors facing right")
|
check_eq(left.get_data(), frames[1], "facing left mirrors facing right")
|
||||||
var other := style._figure_image(1, 0, false).image
|
var other := style._figure_image(1, 0, false).image
|
||||||
check(other.get_data() != frames[0], "another player has another colour")
|
check(other.get_data() != frames[0], "another player has another colour")
|
||||||
|
|
||||||
|
|
||||||
|
func test_the_head_keeps_its_outline_in_every_step() -> void:
|
||||||
|
var style := WarmStyle.new()
|
||||||
|
for frame in 5:
|
||||||
|
var image := style._figure_image(0, frame, false).image
|
||||||
|
for x in image.get_width():
|
||||||
|
var top := image.get_pixel(x, 0)
|
||||||
|
check(top.a == 0.0 or top == style.palette["outline"], "frame %d, column %d: %s" % [frame, x, top])
|
||||||
|
|||||||
Reference in New Issue
Block a user