Spielfeld über Art zeichnen

Karte, Figuren und Zielmarke zeichnet jetzt Art. Die Karte zeichnet in
Blöcken von 16 mal 16 Kacheln und nach einem Treffer nur die Blöcke um
die Kachel neu; jede Kachel kennt ihre Nachbarn. Figuren stehen
aufrecht in ihrer Kachel, schreiten und schauen in die Richtung, in die
sie gehen. Der eigene Schlag zeigt seine Splitter sofort, auch als Gast,
und die Namen über fremden Figuren werden in Bildschirmgröße gezeichnet
und bleiben scharf.

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
This commit is contained in:
Steven Wroblewski
2026-10-02 11:49:18 +02:00
parent 9921aba63a
commit d2a7973022
10 changed files with 422 additions and 64 deletions
+23
View File
@@ -31,3 +31,26 @@ func test_without_a_map_the_figure_stays() -> void:
avatar.walk(Vector2.LEFT, 0.1)
check_eq(avatar.position, Vector2.ZERO, "no walkability callable")
avatar.free()
func test_a_walking_figure_steps_and_faces_the_way_it_goes() -> void:
var avatar := Avatar.new()
avatar.is_walkable = _open_field
avatar.position = GridMotion.tile_center(Vector2i(50, 50))
check(not avatar.moving, "standing at first")
avatar.walk(Vector2.LEFT, 0.1)
check(avatar.moving, "walking")
check_eq(avatar.facing, -1.0, "facing left")
check(avatar.step > 0.0, "the step turns")
avatar.walk(Vector2.UP, 0.1)
check_eq(avatar.facing, -1.0, "walking up keeps the way it faces")
avatar.walk(Vector2.ZERO, 0.1)
check(not avatar.moving, "standing again")
avatar.free()
func test_a_figure_stands_upright_in_its_tile() -> void:
var rect := Avatar.figure_rect(Vector2(100, 100))
check_eq(rect.size, Vector2(GridMotion.TILE_SIZE, GridMotion.TILE_SIZE * 1.5), "a tile wide, one and a half tall")
check_eq(rect.get_center().x, 100.0, "centred on the figure")
check_eq(rect.end.y, 100.0 + Avatar.RADIUS + 1.0, "its feet just below its body")