Compare commits
8
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7c2c08e180 | ||
|
|
929e5a394c | ||
|
|
515cf72594 | ||
|
|
c750399128 | ||
|
|
4e356ee7b8 | ||
|
|
0615f5b89d | ||
|
|
ea4bbf15fa | ||
|
|
1dd1b36b5e |
@@ -1,2 +1,3 @@
|
||||
.godot/
|
||||
*.import
|
||||
artifacts/
|
||||
|
||||
@@ -1,27 +1,84 @@
|
||||
# Dungeon Crawler World — S1 Walking Skeleton
|
||||
# Dungeon Crawler World — S4 Audio and visual verification
|
||||
|
||||
## Prerequisites
|
||||
Godot 4.2+ (verified with Godot 4.5) is required. GUT **9.5.0** is vendored and pinned at `addons/gut`.
|
||||
|
||||
## Run
|
||||
Godot 4.2+ is required (verified with Godot 4.5). GUT **9.5.0** is vendored and pinned at `addons/gut`. Linux visual verification needs either an active display or `xvfb-run`; the verification script uses Xvfb automatically when `DISPLAY` is unset.
|
||||
|
||||
## Run on Linux
|
||||
|
||||
```bash
|
||||
"${GODOT_BIN:-$(command -v godot4 || command -v godot)}" --path .
|
||||
```
|
||||
Use WASD / arrow keys (and QEZC diagonals). The deterministic public E2E seam is `Game.submit_test_action(Vector2i)`; it calls the same action processor as keyboard input.
|
||||
|
||||
## Tests
|
||||
Use WASD / arrow keys (and QEZC diagonals). `Game.submit_test_action(Vector2i)` is the deterministic public E2E seam and follows the same action processor as keyboard input.
|
||||
|
||||
## Display, grid, and camera
|
||||
|
||||
The project reference viewport is **1280×720**, with canvas-item stretching and a resizable window. Dungeon coordinates remain in the `cell * 32` domain: `MapRenderer.get_cell_rect(cell)` returns the exact 32×32 world rectangle for a cell, and `Game.get_actor_cell_rect(actor_id)` exposes the effective actor image rectangle. Actor sprites are top-left anchored so their complete 32×32 image is contained in their cell before and after movement.
|
||||
|
||||
`Camera2D` follows the player after each valid action and is bounded to the map's world rectangle. The public HUD nodes stay below `HUD` (`CanvasLayer`, layer 1), so they remain viewport-anchored rather than moving with the camera.
|
||||
|
||||
### S5.1 verification note
|
||||
|
||||
The S5.1 contract—1280×720 reference viewport, actor rectangle, and camera behavior—is covered by the dedicated tests and visual capture check. This note records coverage only; it does not assert an execution result.
|
||||
|
||||
## Optional ASCII audio layout
|
||||
|
||||
Audio is optional presentation. Its absence, unknown requests, missing folders, bad files, and unsupported codecs never affect a turn or game startup. No audio files ship with this repository.
|
||||
|
||||
`AudioLibrary` first searches the directory named by `DCW_AUDIO_HOME`; when it is unset, it searches `~/.local/share/dcwascii`. Place tracks in this exact layout:
|
||||
|
||||
```text
|
||||
<root>/
|
||||
├── audio/
|
||||
│ ├── exploration/
|
||||
│ ├── combat/
|
||||
│ └── danger/
|
||||
└── sfx/
|
||||
├── attack_given/
|
||||
├── attack_received/
|
||||
├── menu_select/
|
||||
├── menu_cancel/
|
||||
├── item_use/
|
||||
└── death/
|
||||
```
|
||||
|
||||
Admitted file extensions are `.mp3`, `.ogg`, `.oga`, `.wav`, `.flac`, `.m4a`, and `.opus`. `AudioLibrary` discovers the first admitted regular file in each requested directory and exposes that path only as diagnostics (`get_last_ambience_path` / `get_last_sfx_path`). **This prototype never loads or plays external audio:** it does not invoke `AudioStream*.load_from_file`, `ResourceLoader`, or another Godot loader on files below these roots, regardless of extension or apparent validity. A nominal or truncated `.wav` is therefore equally non-playable (`has_playable_ambience()` / `has_playable_sfx()` return `false`) and cannot affect gameplay. Directory discovery is deliberately best-effort and error-free; it is not a promise that the discovered file can be read or played. The game still selects `exploration` at startup, changes to `combat` for a combat result, and dispatches audio requests for player attacks, enemy attacks, and death without blocking those actions.
|
||||
|
||||
Example:
|
||||
|
||||
```bash
|
||||
DCW_AUDIO_HOME="$HOME/.local/share/dcwascii" "${GODOT_BIN:-godot4}" --path .
|
||||
```
|
||||
|
||||
## Tests and visual check
|
||||
|
||||
```bash
|
||||
GODOT_BIN=/snap/bin/godot4 ./scripts/test-unit.sh
|
||||
GODOT_BIN=/snap/bin/godot4 ./scripts/test-e2e.sh
|
||||
GODOT_BIN=/snap/bin/godot4 ./scripts/run-visual-check.sh
|
||||
GODOT_BIN=/snap/bin/godot4 ./scripts/verify.sh
|
||||
```
|
||||
Scripts use `GODOT_BIN`, otherwise discover `godot4`, then `godot`, and run headlessly.
|
||||
|
||||
## Exploration et FOV
|
||||
- Les cellules actuellement dans `GameState.visible_cells` sont affichées à pleine luminosité.
|
||||
- Les cellules présentes seulement dans `GameState.explored_cells` restent visibles, mais sont assombries ; les cellules inconnues sont noires.
|
||||
- La FOV est calculée contre la carte : les murs et portes fermées restent visibles mais masquent les cases situées derrière eux.
|
||||
- Le rendu est synchronisé après chaque action via le même chemin que les entrées clavier et `Game.submit_test_action(Vector2i)`.
|
||||
`run-visual-check.sh` runs the actual project with `--capture`, waits for it to render, logs output to `artifacts/visual-check.log`, and requires the project-owned capture at `artifacts/visual-check.png` to be a valid **1280×720** PNG. It chooses `xvfb-run` with a 1280×720 screen when no display is available, enforces a timeout, and reports **unavailable** (rather than a false pass) when neither a display nor Xvfb exists. `verify.sh` runs unit tests and headless E2E before visual verification; unavailable visual verification is reported distinctly from a failed test or failed visual capture.
|
||||
|
||||
For a direct headless startup check:
|
||||
|
||||
```bash
|
||||
GODOT_BIN=/snap/bin/godot4 timeout 3s /snap/bin/godot4 --headless --path .
|
||||
```
|
||||
|
||||
## Exploration, combat, and HUD
|
||||
|
||||
- `GameState.visible_cells` render at full brightness; cells retained in `explored_cells` render dimly; unknown cells are black.
|
||||
- FOV is map-aware: walls and closed doors are visible but block cells behind them.
|
||||
- `HUD/PlayerHealthLabel`, `HUD/EnemyHealthLabel`, `HUD/CombatSummaryLabel`, and `HUD/EventLog` expose the current combat state.
|
||||
- Every `melee` and `enemy_melee` result is routed to its actor view; the sprite's persistent red tint makes received damage visible.
|
||||
|
||||
## Exports
|
||||
|
||||
Install the matching Godot export templates, then configure/export the project in the Godot editor for **Linux/X11** or **Windows Desktop**. Linux builds may be tested on a Linux host with the resulting executable. Windows exports can be produced from Linux when the export templates are installed, but this project does **not** claim that a Windows export has been tested on Windows.
|
||||
|
||||
## Limits
|
||||
This slice deliberately provides one compact map, one deterministic goblin, direct pursuit, no persistence, inventory, audio, or animation.
|
||||
|
||||
This compact prototype has one deterministic goblin, direct pursuit, no persistence or inventory UI, and persistent rather than animated damage tint. Audio remains intentionally nonblocking and uses no bundled assets.
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
# S4 round 2 — external audio ruling
|
||||
|
||||
## Decision
|
||||
|
||||
The S4 prototype may discover admitted audio filenames under the configured ASCII external roots, but it must never ask Godot to read, decode, import, or play those files. This is a safety boundary, not a codec-validation problem: a superficial signature cannot establish that a file is complete or safe for a downstream loader.
|
||||
|
||||
## Implementation
|
||||
|
||||
- `AudioLibrary` retains best-effort, error-free directory discovery for the documented roots and admitted extensions.
|
||||
- The last discovered ambience/SFX paths remain diagnostic-only public getters.
|
||||
- All byte-signature checks and `FileAccess` header reads were removed.
|
||||
- All `AudioStream*.load_from_file` calls, stream players, and external-load helper paths were removed.
|
||||
- `has_playable_ambience()` and `has_playable_sfx()` are public diagnostics and currently always return `false`.
|
||||
- `set_ambience_context` and `play_sfx` still accept their supported requests and cannot block or change game-state resolution.
|
||||
|
||||
## Verification coverage
|
||||
|
||||
Unit and E2E coverage create both a structurally nominal WAV and a truncated/invalid WAV in the external layout. They assert discovery remains diagnostic-only, neither file is playable through the public API, and combat still resolves normally. The README now states that discovery does not promise readability or playback.
|
||||
|
||||
## S5.1 RED evidence reconstruction
|
||||
|
||||
On base `515cf72`, a test referencing `Game.REFERENCE_VIEWPORT` produced:
|
||||
|
||||
```text
|
||||
SCRIPT ERROR: Parse Error: Cannot find member REFERENCE_VIEWPORT in base Game
|
||||
```
|
||||
|
||||
The runner exited with status `1`.
|
||||
@@ -1,4 +1,6 @@
|
||||
# Asset registry — S1
|
||||
# Asset registry — S4
|
||||
|
||||
S4 added no binary assets. Audio remains external under the documented ASCII layout; the project-owned visual capture is generated under ignored `artifacts/` and is not a shipped asset.
|
||||
|
||||
All binary art below is an unmodified 32×32 PNG copied from the local **Dungeon Crawl Stone Soup Full** tile pack. The pack README identifies it as CC0; `assets/dcss/LICENSE-CC0-1.0.txt` is the included source license copy. Attribution is not required, but the pack is credited here as requested by its README.
|
||||
|
||||
|
||||
+6
-4
@@ -7,10 +7,12 @@ config/name="Dungeon Crawler World"
|
||||
run/main_scene="res://scenes/Game.tscn"
|
||||
|
||||
[display]
|
||||
window/size/viewport_width=640
|
||||
window/size/viewport_height=480
|
||||
window/size/window_width_override=640
|
||||
window/size/window_height_override=480
|
||||
window/size/viewport_width=1280
|
||||
window/size/viewport_height=720
|
||||
window/size/window_width_override=1280
|
||||
window/size/window_height_override=720
|
||||
window/size/resizable=true
|
||||
window/stretch/mode="canvas_items"
|
||||
|
||||
[rendering]
|
||||
renderer/rendering_method="gl_compatibility"
|
||||
|
||||
+14
-1
@@ -5,10 +5,14 @@
|
||||
[ext_resource type="Script" path="res://scripts/presentation/actor_view.gd" id="3_actor"]
|
||||
[ext_resource type="Script" path="res://scripts/presentation/hud.gd" id="4_hud"]
|
||||
[ext_resource type="Texture2D" path="res://assets/dcss/player.png" id="5_player"]
|
||||
[ext_resource type="Script" path="res://scripts/infrastructure/audio_library.gd" id="6_audio"]
|
||||
|
||||
[node name="Game" type="Node2D"]
|
||||
script = ExtResource("1_game")
|
||||
|
||||
[node name="AudioLibrary" type="Node" parent="."]
|
||||
script = ExtResource("6_audio")
|
||||
|
||||
[node name="World" type="Node2D" parent="."]
|
||||
position = Vector2(32, 48)
|
||||
|
||||
@@ -22,9 +26,10 @@ script = ExtResource("3_actor")
|
||||
[node name="Enemies" type="Node2D" parent="World"]
|
||||
|
||||
[node name="Camera2D" type="Camera2D" parent="."]
|
||||
position = Vector2(320, 240)
|
||||
position_smoothing_enabled = false
|
||||
|
||||
[node name="HUD" type="CanvasLayer" parent="."]
|
||||
layer = 1
|
||||
script = ExtResource("4_hud")
|
||||
|
||||
[node name="PlayerHealthLabel" type="Label" parent="HUD"]
|
||||
@@ -43,6 +48,14 @@ offset_bottom = 60.0
|
||||
theme_override_colors/font_color = Color(1, 0.8, 0.7, 1)
|
||||
theme_override_font_sizes/font_size = 18
|
||||
|
||||
[node name="CombatSummaryLabel" type="Label" parent="HUD"]
|
||||
offset_left = 12.0
|
||||
offset_top = 60.0
|
||||
offset_right = 300.0
|
||||
offset_bottom = 85.0
|
||||
theme_override_colors/font_color = Color(1, 0.9, 0.5, 1)
|
||||
theme_override_font_sizes/font_size = 16
|
||||
|
||||
[node name="EventLog" type="RichTextLabel" parent="HUD"]
|
||||
offset_left = 410.0
|
||||
offset_top = 285.0
|
||||
|
||||
+57
-1
@@ -1,16 +1,18 @@
|
||||
class_name Game
|
||||
extends Node2D
|
||||
|
||||
const REFERENCE_VIEWPORT := Vector2i(1280, 720)
|
||||
const TILE_SIZE := Vector2i(32, 32)
|
||||
const GridMapStateType = preload("res://scripts/domain/grid_map_state.gd")
|
||||
const ActorStateType = preload("res://scripts/domain/actor_state.gd")
|
||||
const GameStateType = preload("res://scripts/domain/game_state.gd")
|
||||
const ActorViewType = preload("res://scripts/presentation/actor_view.gd")
|
||||
|
||||
@onready var map_renderer: MapRenderer = $World/MapRenderer
|
||||
@onready var player_view: ActorView = $World/Player
|
||||
@onready var enemies: Node2D = $World/Enemies
|
||||
@onready var camera: Camera2D = $Camera2D
|
||||
@onready var hud: GameHud = $HUD
|
||||
@onready var audio_library = $AudioLibrary
|
||||
var game_state: GameState
|
||||
var enemy_views: Dictionary[StringName, ActorView] = {}
|
||||
|
||||
@@ -19,8 +21,22 @@ func _ready() -> void:
|
||||
map_renderer.set_map(game_state.map)
|
||||
_sync_map_renderer_visibility()
|
||||
player_view.set_actor(game_state.player)
|
||||
_configure_camera()
|
||||
_sync_enemy_views()
|
||||
hud.refresh(game_state)
|
||||
audio_library.set_ambience_context("exploration")
|
||||
if "--capture" in OS.get_cmdline_user_args():
|
||||
_capture_visual_check()
|
||||
|
||||
func _capture_visual_check() -> void:
|
||||
await get_tree().process_frame
|
||||
await get_tree().process_frame
|
||||
await RenderingServer.frame_post_draw
|
||||
var capture_path := ProjectSettings.globalize_path("res://artifacts/visual-check.png")
|
||||
DirAccess.make_dir_recursive_absolute(capture_path.get_base_dir())
|
||||
var image := get_viewport().get_texture().get_image()
|
||||
var result := image.save_png(capture_path)
|
||||
get_tree().quit(0 if result == OK else 1)
|
||||
|
||||
func _unhandled_input(event: InputEvent) -> void:
|
||||
if event.is_action_pressed(&"move_north"):
|
||||
@@ -46,14 +62,43 @@ func submit_test_action(direction: Vector2i) -> Array[TurnResult]:
|
||||
func get_game_state() -> GameState:
|
||||
return game_state
|
||||
|
||||
func get_actor_cell_rect(actor_id: StringName) -> Rect2:
|
||||
if actor_id == &"player":
|
||||
return player_view.get_cell_rect()
|
||||
if enemy_views.has(actor_id):
|
||||
return enemy_views[actor_id].get_cell_rect()
|
||||
return Rect2()
|
||||
|
||||
func _process_action(direction: Vector2i) -> Array[TurnResult]:
|
||||
var results := game_state.try_player_action(direction)
|
||||
_sync_map_renderer_visibility()
|
||||
player_view.refresh()
|
||||
_sync_camera_to_player()
|
||||
_sync_enemy_views()
|
||||
_show_damage_feedback(results)
|
||||
_dispatch_audio(results)
|
||||
hud.refresh(game_state, results)
|
||||
return results
|
||||
|
||||
func _dispatch_audio(results: Array[TurnResult]) -> void:
|
||||
for result in results:
|
||||
match result.kind:
|
||||
&"melee":
|
||||
audio_library.set_ambience_context("combat")
|
||||
audio_library.play_sfx("attack_given")
|
||||
&"enemy_melee":
|
||||
audio_library.set_ambience_context("combat")
|
||||
audio_library.play_sfx("attack_received")
|
||||
&"enemy_defeated":
|
||||
audio_library.play_sfx("death")
|
||||
|
||||
func _show_damage_feedback(results: Array[TurnResult]) -> void:
|
||||
for result in results:
|
||||
if result.kind == &"melee" and enemy_views.has(result.target_id):
|
||||
enemy_views[result.target_id].show_damage(result.damage)
|
||||
elif result.kind == &"enemy_melee":
|
||||
player_view.show_damage(result.damage)
|
||||
|
||||
func _create_initial_state() -> GameState:
|
||||
var map := GridMapStateType.new(Vector2i(12, 10), GridMapStateType.CellKind.FLOOR)
|
||||
for x in range(map.size.x):
|
||||
@@ -70,6 +115,17 @@ func _create_initial_state() -> GameState:
|
||||
var goblin := ActorStateType.new(&"goblin", Vector2i(4, 2), 6, 2)
|
||||
return GameStateType.new(map, player, {&"goblin": goblin})
|
||||
|
||||
func _configure_camera() -> void:
|
||||
var map_size := game_state.map.size * TILE_SIZE
|
||||
camera.limit_left = $World.position.x
|
||||
camera.limit_top = $World.position.y
|
||||
camera.limit_right = $World.position.x + map_size.x
|
||||
camera.limit_bottom = $World.position.y + map_size.y
|
||||
_sync_camera_to_player()
|
||||
|
||||
func _sync_camera_to_player() -> void:
|
||||
camera.position = $World.position + Vector2(game_state.player.cell * TILE_SIZE)
|
||||
|
||||
func _sync_map_renderer_visibility() -> void:
|
||||
map_renderer.set_visibility(game_state.visible_cells, game_state.explored_cells)
|
||||
|
||||
|
||||
@@ -0,0 +1,65 @@
|
||||
class_name AudioLibrary
|
||||
extends Node
|
||||
|
||||
const AMBIENCE_CONTEXTS := ["exploration", "combat", "danger"]
|
||||
const SFX_EVENTS := ["attack_given", "attack_received", "menu_select", "menu_cancel", "item_use", "death"]
|
||||
const ADMITTED_EXTENSIONS := ["mp3", "ogg", "oga", "wav", "flac", "m4a", "opus"]
|
||||
const DEFAULT_AUDIO_HOME := ".local/share/dcwascii"
|
||||
|
||||
var current_ambience_context := ""
|
||||
var _audio_home_override := ""
|
||||
var _last_ambience_path := ""
|
||||
var _last_sfx_path := ""
|
||||
|
||||
func _init(audio_home_override: String = "") -> void:
|
||||
_audio_home_override = audio_home_override
|
||||
|
||||
func set_ambience_context(context: String) -> void:
|
||||
if not context in AMBIENCE_CONTEXTS:
|
||||
return
|
||||
current_ambience_context = context
|
||||
_last_ambience_path = _find_first_audio_file("audio", current_ambience_context)
|
||||
|
||||
func play_sfx(event: String) -> void:
|
||||
_last_sfx_path = ""
|
||||
if not event in SFX_EVENTS:
|
||||
return
|
||||
_last_sfx_path = _find_first_audio_file("sfx", event)
|
||||
|
||||
func get_last_ambience_path() -> String:
|
||||
return _last_ambience_path
|
||||
|
||||
func get_last_sfx_path() -> String:
|
||||
return _last_sfx_path
|
||||
|
||||
func has_playable_ambience() -> bool:
|
||||
return false
|
||||
|
||||
func has_playable_sfx() -> bool:
|
||||
return false
|
||||
|
||||
func _audio_roots() -> Array[String]:
|
||||
if not _audio_home_override.is_empty():
|
||||
return [_audio_home_override]
|
||||
var roots: Array[String] = []
|
||||
var environment_root := OS.get_environment("DCW_AUDIO_HOME")
|
||||
if not environment_root.is_empty():
|
||||
roots.append(environment_root)
|
||||
roots.append(OS.get_environment("HOME").path_join(DEFAULT_AUDIO_HOME))
|
||||
return roots
|
||||
|
||||
func _find_first_audio_file(kind: String, name: String) -> String:
|
||||
for root in _audio_roots():
|
||||
var directory_path := root.path_join(kind).path_join(name)
|
||||
var directory := DirAccess.open(directory_path)
|
||||
if directory == null:
|
||||
continue
|
||||
directory.list_dir_begin()
|
||||
var entry := directory.get_next()
|
||||
while not entry.is_empty():
|
||||
if not directory.current_is_dir() and entry.get_extension().to_lower() in ADMITTED_EXTENSIONS:
|
||||
directory.list_dir_end()
|
||||
return directory_path.path_join(entry)
|
||||
entry = directory.get_next()
|
||||
directory.list_dir_end()
|
||||
return ""
|
||||
@@ -0,0 +1 @@
|
||||
uid://c1s4audiolibrary
|
||||
@@ -2,12 +2,25 @@ class_name ActorView
|
||||
extends Sprite2D
|
||||
|
||||
const TILE_SIZE := Vector2i(32, 32)
|
||||
const DAMAGE_MODULATE := Color(1.0, 0.45, 0.45, 1.0)
|
||||
var actor: ActorState
|
||||
var last_damage := 0
|
||||
|
||||
func _init() -> void:
|
||||
centered = false
|
||||
|
||||
func get_cell_rect() -> Rect2:
|
||||
var local_image_rect := get_rect()
|
||||
return Rect2(position + local_image_rect.position, local_image_rect.size)
|
||||
|
||||
func set_actor(new_actor: ActorState) -> void:
|
||||
actor = new_actor
|
||||
refresh()
|
||||
|
||||
func show_damage(amount: int) -> void:
|
||||
last_damage = amount
|
||||
modulate = DAMAGE_MODULATE
|
||||
|
||||
func refresh() -> void:
|
||||
if actor != null:
|
||||
position = Vector2(actor.cell) * Vector2(TILE_SIZE)
|
||||
|
||||
@@ -3,14 +3,19 @@ extends CanvasLayer
|
||||
|
||||
@onready var player_health_label: Label = $PlayerHealthLabel
|
||||
@onready var enemy_health_label: Label = $EnemyHealthLabel
|
||||
@onready var combat_summary_label: Label = $CombatSummaryLabel
|
||||
@onready var event_log: RichTextLabel = $EventLog
|
||||
var combat_summary := ""
|
||||
|
||||
func refresh(state: GameState, results: Array[TurnResult] = []) -> void:
|
||||
player_health_label.text = "Player HP: %d/%d" % [state.player.hit_points, state.player.max_hit_points]
|
||||
if state.enemies.has(&"goblin"):
|
||||
var goblin: ActorState = state.enemies[&"goblin"]
|
||||
enemy_health_label.text = "Goblin HP: %d/%d" % [goblin.hit_points, goblin.max_hit_points]
|
||||
combat_summary = "Target: Goblin HP: %d/%d" % [goblin.hit_points, goblin.max_hit_points]
|
||||
else:
|
||||
enemy_health_label.text = "Goblin defeated"
|
||||
enemy_health_label.text = "No active target"
|
||||
combat_summary = "No active target"
|
||||
combat_summary_label.text = combat_summary
|
||||
for result in results:
|
||||
event_log.append_text(result.message + "\n")
|
||||
|
||||
@@ -16,6 +16,9 @@ var map: GridMapState
|
||||
var _visible_cells: Dictionary[Vector2i, bool] = {}
|
||||
var _explored_cells: Dictionary[Vector2i, bool] = {}
|
||||
|
||||
func get_cell_rect(cell: Vector2i) -> Rect2:
|
||||
return Rect2(Vector2(cell * TILE_SIZE), Vector2(TILE_SIZE))
|
||||
|
||||
func set_map(new_map: GridMapState) -> void:
|
||||
map = new_map
|
||||
queue_redraw()
|
||||
@@ -47,7 +50,7 @@ func _draw() -> void:
|
||||
for y in range(map.size.y):
|
||||
for x in range(map.size.x):
|
||||
var cell := Vector2i(x, y)
|
||||
var tile_rect := Rect2(Vector2(cell * TILE_SIZE), Vector2(TILE_SIZE))
|
||||
var tile_rect := get_cell_rect(cell)
|
||||
var color := get_cell_render_color(cell)
|
||||
if color == Color.BLACK:
|
||||
draw_rect(tile_rect, Color.BLACK)
|
||||
|
||||
Executable
+66
@@ -0,0 +1,66 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
root_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
||||
cd "$root_dir"
|
||||
GODOT_BIN="${GODOT_BIN:-/snap/bin/godot4}"
|
||||
if [[ ! -x "$GODOT_BIN" ]]; then
|
||||
GODOT_BIN="$(command -v godot4 || command -v godot || true)"
|
||||
fi
|
||||
if [[ -z "$GODOT_BIN" ]]; then
|
||||
echo "visual check unavailable: set GODOT_BIN or install godot4/godot" >&2
|
||||
exit 2
|
||||
fi
|
||||
|
||||
mkdir -p artifacts
|
||||
log_path="artifacts/visual-check.log"
|
||||
capture_path="artifacts/visual-check.png"
|
||||
rm -f "$capture_path"
|
||||
|
||||
runner=()
|
||||
if [[ -z "${DISPLAY:-}" ]]; then
|
||||
if command -v xvfb-run >/dev/null 2>&1; then
|
||||
runner=(xvfb-run --auto-servernum --server-args="-screen 0 1280x720x24")
|
||||
else
|
||||
echo "visual check unavailable: DISPLAY is unset and xvfb-run is not installed" | tee "$log_path" >&2
|
||||
exit 2
|
||||
fi
|
||||
fi
|
||||
|
||||
set +e
|
||||
timeout --foreground 20s "${runner[@]}" "$GODOT_BIN" --path . -- --capture >"$log_path" 2>&1
|
||||
status=$?
|
||||
set -e
|
||||
if (( status != 0 )); then
|
||||
echo "visual check failed: Godot exited with status $status; see $log_path" >&2
|
||||
exit "$status"
|
||||
fi
|
||||
if grep -Eq 'SCRIPT ERROR|Parse Error|^ERROR:' "$log_path"; then
|
||||
echo "visual check failed: Godot reported errors; see $log_path" >&2
|
||||
exit 1
|
||||
fi
|
||||
if [[ ! -s "$capture_path" ]]; then
|
||||
echo "visual check failed: missing capture $capture_path" >&2
|
||||
exit 1
|
||||
fi
|
||||
if ! python3 - "$capture_path" <<'PY'
|
||||
import struct
|
||||
import sys
|
||||
|
||||
path = sys.argv[1]
|
||||
with open(path, "rb") as capture:
|
||||
signature = capture.read(8)
|
||||
length = struct.unpack(">I", capture.read(4))[0]
|
||||
kind = capture.read(4)
|
||||
data = capture.read(length)
|
||||
if signature != b"\x89PNG\r\n\x1a\n" or kind != b"IHDR" or len(data) != 13:
|
||||
raise SystemExit("invalid PNG")
|
||||
width, height = struct.unpack(">II", data[:8])
|
||||
if (width, height) != (1280, 720):
|
||||
raise SystemExit(f"expected 1280x720 PNG, got {width}x{height}")
|
||||
print(f"visual capture: {path} ({width}x{height})")
|
||||
PY
|
||||
then
|
||||
echo "visual check failed: capture is not a nonempty valid PNG" >&2
|
||||
exit 1
|
||||
fi
|
||||
+12
-1
@@ -5,4 +5,15 @@ if [[ ! -x "$GODOT_BIN" ]]; then
|
||||
GODOT_BIN="$(command -v godot4 || command -v godot || true)"
|
||||
fi
|
||||
: "${GODOT_BIN:?Set GODOT_BIN or install godot4/godot}"
|
||||
exec "$GODOT_BIN" --headless --path . -s res://addons/gut/gut_cmdln.gd -gdir=res://tests/e2e -gexit
|
||||
|
||||
log_path="$(mktemp)"
|
||||
trap 'rm -f "$log_path"' EXIT
|
||||
set +e
|
||||
"$GODOT_BIN" --headless --path . -s res://addons/gut/gut_cmdln.gd -gdir=res://tests/e2e -gexit 2>&1 | tee "$log_path"
|
||||
godot_status=${PIPESTATUS[0]}
|
||||
set -e
|
||||
if grep -Eq 'SCRIPT ERROR|Parse Error' "$log_path"; then
|
||||
echo "E2E tests failed: Godot reported a script or parse error" >&2
|
||||
exit 1
|
||||
fi
|
||||
exit "$godot_status"
|
||||
|
||||
+12
-1
@@ -5,4 +5,15 @@ if [[ ! -x "$GODOT_BIN" ]]; then
|
||||
GODOT_BIN="$(command -v godot4 || command -v godot || true)"
|
||||
fi
|
||||
: "${GODOT_BIN:?Set GODOT_BIN or install godot4/godot}"
|
||||
exec "$GODOT_BIN" --headless --path . -s res://addons/gut/gut_cmdln.gd -gdir=res://tests/unit -gexit
|
||||
|
||||
log_path="$(mktemp)"
|
||||
trap 'rm -f "$log_path"' EXIT
|
||||
set +e
|
||||
"$GODOT_BIN" --headless --path . -s res://addons/gut/gut_cmdln.gd -gdir=res://tests/unit -gexit 2>&1 | tee "$log_path"
|
||||
godot_status=${PIPESTATUS[0]}
|
||||
set -e
|
||||
if grep -Eq 'SCRIPT ERROR|Parse Error' "$log_path"; then
|
||||
echo "unit tests failed: Godot reported a script or parse error" >&2
|
||||
exit 1
|
||||
fi
|
||||
exit "$godot_status"
|
||||
|
||||
+21
-2
@@ -1,4 +1,23 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
"$(dirname "$0")/test-unit.sh"
|
||||
"$(dirname "$0")/test-e2e.sh"
|
||||
|
||||
script_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
"$script_dir/test-unit.sh"
|
||||
"$script_dir/test-e2e.sh"
|
||||
|
||||
set +e
|
||||
"$script_dir/run-visual-check.sh"
|
||||
visual_status=$?
|
||||
set -e
|
||||
case "$visual_status" in
|
||||
0)
|
||||
echo "verify: unit, E2E, and visual checks passed"
|
||||
;;
|
||||
2)
|
||||
echo "verify: unit and E2E checks passed; visual check unavailable" >&2
|
||||
;;
|
||||
*)
|
||||
echo "verify: visual check failed after unit and E2E checks passed" >&2
|
||||
exit "$visual_status"
|
||||
;;
|
||||
esac
|
||||
|
||||
@@ -38,9 +38,15 @@ func test_real_game_scene_completes_walking_combat_and_defeat_route() -> void:
|
||||
assert_not_null(game.get_node_or_null("Camera2D"))
|
||||
assert_not_null(game.get_node_or_null("HUD/PlayerHealthLabel"))
|
||||
assert_not_null(game.get_node_or_null("HUD/EnemyHealthLabel"))
|
||||
assert_not_null(game.get_node_or_null("HUD/CombatSummaryLabel"))
|
||||
assert_not_null(game.get_node_or_null("HUD/EventLog"))
|
||||
|
||||
var state := game.get_game_state()
|
||||
var hud := game.get_node("HUD") as GameHud
|
||||
var player_view := game.get_node("World/Player") as ActorView
|
||||
var enemy_view := game.get_node("World/Enemies/Goblin") as ActorView
|
||||
assert_eq(hud.combat_summary, "Target: Goblin HP: 6/6")
|
||||
assert_eq(hud.combat_summary_label.text, "Target: Goblin HP: 6/6")
|
||||
var start := state.player.cell
|
||||
var wall := game.submit_test_action(Vector2i.LEFT)
|
||||
assert_eq(wall[0].kind, &"blocked")
|
||||
@@ -54,17 +60,26 @@ func test_real_game_scene_completes_walking_combat_and_defeat_route() -> void:
|
||||
assert_eq(movement[0].kind, &"moved")
|
||||
assert_eq(state.player.cell, start + Vector2i.RIGHT)
|
||||
assert_eq(movement[1].kind, &"enemy_melee")
|
||||
assert_eq(player_view.last_damage, 2)
|
||||
assert_string_contains(game.get_node("HUD/EventLog").get_parsed_text(), "You move")
|
||||
assert_string_contains(game.get_node("HUD/PlayerHealthLabel").text, "10/12")
|
||||
var first_melee := game.submit_test_action(Vector2i.RIGHT)
|
||||
assert_eq(first_melee[0].kind, &"melee")
|
||||
assert_eq(first_melee[1].kind, &"enemy_melee")
|
||||
assert_eq(enemy_view.last_damage, 3)
|
||||
assert_eq(player_view.last_damage, 2)
|
||||
assert_string_contains(game.get_node("HUD/EnemyHealthLabel").text, "3/6")
|
||||
assert_eq(hud.combat_summary, "Target: Goblin HP: 3/6")
|
||||
assert_eq(hud.combat_summary_label.text, "Target: Goblin HP: 3/6")
|
||||
assert_string_contains(hud.event_log.get_parsed_text(), "You strike the goblin for 3.")
|
||||
var lethal_melee := game.submit_test_action(Vector2i.RIGHT)
|
||||
assert_eq(lethal_melee[0].kind, &"melee")
|
||||
assert_eq(lethal_melee[1].kind, &"enemy_defeated")
|
||||
assert_false(state.enemies.has(&"goblin"))
|
||||
await get_tree().process_frame
|
||||
assert_eq(game.get_node("World/Enemies").get_child_count(), 0)
|
||||
assert_string_contains(game.get_node("HUD/EnemyHealthLabel").text, "defeated")
|
||||
assert_eq(game.get_node_or_null("World/Enemies/Goblin"), null)
|
||||
assert_eq(game.get_node("HUD/EnemyHealthLabel").text, "No active target")
|
||||
assert_eq(hud.combat_summary, "No active target")
|
||||
assert_eq(hud.combat_summary_label.text, "No active target")
|
||||
assert_string_contains(game.get_node("HUD/EventLog").get_parsed_text(), "defeated")
|
||||
@@ -0,0 +1 @@
|
||||
uid://0vj24y2urx3s
|
||||
@@ -0,0 +1,32 @@
|
||||
extends GutTest
|
||||
|
||||
const GameScene = preload("res://scenes/Game.tscn")
|
||||
var game: Game
|
||||
|
||||
func before_each() -> void:
|
||||
game = GameScene.instantiate()
|
||||
add_child_autofree(game)
|
||||
await get_tree().process_frame
|
||||
|
||||
func test_real_game_keyboard_movement_keeps_actor_in_cell_and_updates_camera_without_moving_hud() -> void:
|
||||
var renderer := game.get_node("World/MapRenderer") as MapRenderer
|
||||
var camera := game.get_node("Camera2D") as Camera2D
|
||||
var hud := game.get_node("HUD") as CanvasLayer
|
||||
var state := game.get_game_state()
|
||||
var player_health_label := game.get_node("HUD/PlayerHealthLabel") as Label
|
||||
var hud_screen_position: Vector2 = player_health_label.get_global_rect().position
|
||||
var start_cell := state.player.cell
|
||||
|
||||
assert_eq(Game.REFERENCE_VIEWPORT, Vector2i(1280, 720))
|
||||
assert_true(renderer.get_cell_rect(start_cell).encloses(game.get_actor_cell_rect(&"player")))
|
||||
|
||||
var keyboard_event := InputEventKey.new()
|
||||
keyboard_event.physical_keycode = KEY_DOWN
|
||||
keyboard_event.pressed = true
|
||||
game._unhandled_input(keyboard_event)
|
||||
|
||||
assert_eq(state.player.cell, start_cell + Vector2i.DOWN)
|
||||
assert_true(renderer.get_cell_rect(state.player.cell).encloses(game.get_actor_cell_rect(&"player")))
|
||||
assert_eq(camera.position, game.get_node("World").position + Vector2(state.player.cell * Game.TILE_SIZE))
|
||||
assert_eq(hud.layer, 1)
|
||||
assert_eq(game.get_node("HUD/PlayerHealthLabel").get_global_rect().position, hud_screen_position)
|
||||
@@ -0,0 +1 @@
|
||||
uid://7xniiqw7cch4
|
||||
@@ -0,0 +1,74 @@
|
||||
extends GutTest
|
||||
|
||||
const GameScene = preload("res://scenes/Game.tscn")
|
||||
const AudioLibrary = preload("res://scripts/infrastructure/audio_library.gd")
|
||||
var empty_audio_home := ""
|
||||
var previous_audio_home := ""
|
||||
var game: Game
|
||||
|
||||
func before_each() -> void:
|
||||
previous_audio_home = OS.get_environment("DCW_AUDIO_HOME")
|
||||
empty_audio_home = ProjectSettings.globalize_path("user://s4-empty-audio-home-%s" % Time.get_ticks_usec())
|
||||
DirAccess.make_dir_recursive_absolute(empty_audio_home)
|
||||
OS.set_environment("DCW_AUDIO_HOME", empty_audio_home)
|
||||
game = GameScene.instantiate()
|
||||
# Replace the scene library before ready to isolate both production search roots.
|
||||
var scene_audio := game.get_node("AudioLibrary")
|
||||
var isolated_audio := AudioLibrary.new(empty_audio_home)
|
||||
isolated_audio.name = "AudioLibrary"
|
||||
game.remove_child(scene_audio)
|
||||
scene_audio.free()
|
||||
game.add_child(isolated_audio)
|
||||
add_child_autofree(game)
|
||||
await get_tree().process_frame
|
||||
|
||||
func after_each() -> void:
|
||||
OS.set_environment("DCW_AUDIO_HOME", previous_audio_home)
|
||||
|
||||
func test_real_game_resolves_combat_with_empty_audio_home() -> void:
|
||||
var audio = game.get_node("AudioLibrary")
|
||||
|
||||
game.submit_test_action(Vector2i.RIGHT)
|
||||
var first_melee := game.submit_test_action(Vector2i.RIGHT)
|
||||
var lethal_melee := game.submit_test_action(Vector2i.RIGHT)
|
||||
|
||||
assert_eq(first_melee[0].kind, &"melee")
|
||||
assert_eq(lethal_melee[1].kind, &"enemy_defeated")
|
||||
assert_false(game.get_game_state().enemies.has(&"goblin"))
|
||||
assert_eq(audio.current_ambience_context, "combat")
|
||||
assert_eq(audio.get_last_ambience_path(), "")
|
||||
assert_eq(audio.get_last_sfx_path(), "")
|
||||
assert_false(audio.has_playable_ambience())
|
||||
assert_false(audio.has_playable_sfx())
|
||||
|
||||
func test_external_nominal_and_invalid_wavs_do_not_affect_combat() -> void:
|
||||
var audio = game.get_node("AudioLibrary")
|
||||
var nominal_path := empty_audio_home.path_join("audio/combat/silence.wav")
|
||||
var invalid_path := empty_audio_home.path_join("sfx/attack_given/truncated.wav")
|
||||
DirAccess.make_dir_recursive_absolute(nominal_path.get_base_dir())
|
||||
DirAccess.make_dir_recursive_absolute(invalid_path.get_base_dir())
|
||||
var nominal_file := FileAccess.open(nominal_path, FileAccess.WRITE)
|
||||
nominal_file.store_buffer(PackedByteArray([
|
||||
82, 73, 70, 70, 36, 0, 0, 0, 87, 65, 86, 69, 102, 109, 116, 32,
|
||||
16, 0, 0, 0, 1, 0, 1, 0, 68, 172, 0, 0, 136, 88, 1, 0,
|
||||
2, 0, 16, 0, 100, 97, 116, 97, 0, 0, 0, 0,
|
||||
]))
|
||||
nominal_file.close()
|
||||
var invalid_file := FileAccess.open(invalid_path, FileAccess.WRITE)
|
||||
invalid_file.store_string("truncated WAV")
|
||||
invalid_file.close()
|
||||
|
||||
game.submit_test_action(Vector2i.RIGHT)
|
||||
var first_melee := game.submit_test_action(Vector2i.RIGHT)
|
||||
var lethal_melee := game.submit_test_action(Vector2i.RIGHT)
|
||||
|
||||
assert_eq(first_melee[0].kind, &"melee")
|
||||
assert_eq(lethal_melee[1].kind, &"enemy_defeated")
|
||||
assert_false(game.get_game_state().enemies.has(&"goblin"))
|
||||
# Discovery remains diagnostic-only after combat; no external stream is playable.
|
||||
audio.set_ambience_context("combat")
|
||||
audio.play_sfx("attack_given")
|
||||
assert_eq(audio.get_last_ambience_path(), nominal_path)
|
||||
assert_eq(audio.get_last_sfx_path(), invalid_path)
|
||||
assert_false(audio.has_playable_ambience())
|
||||
assert_false(audio.has_playable_sfx())
|
||||
@@ -0,0 +1 @@
|
||||
uid://bf8f080ly7oa4
|
||||
@@ -0,0 +1,20 @@
|
||||
extends GutTest
|
||||
|
||||
const GameScene = preload("res://scenes/Game.tscn")
|
||||
var game: Game
|
||||
|
||||
func before_each() -> void:
|
||||
game = GameScene.instantiate()
|
||||
add_child_autofree(game)
|
||||
await get_tree().process_frame
|
||||
|
||||
func test_actor_render_rect_is_contained_in_its_grid_cell_before_and_after_movement() -> void:
|
||||
var renderer := game.get_node("World/MapRenderer") as MapRenderer
|
||||
var player_view := game.get_node("World/Player") as ActorView
|
||||
var state := game.get_game_state()
|
||||
|
||||
assert_true(renderer.get_cell_rect(state.player.cell).encloses(player_view.get_cell_rect()))
|
||||
|
||||
game.submit_test_action(Vector2i.DOWN)
|
||||
|
||||
assert_true(renderer.get_cell_rect(state.player.cell).encloses(player_view.get_cell_rect()))
|
||||
@@ -0,0 +1,57 @@
|
||||
extends GutTest
|
||||
|
||||
const AudioLibrary = preload("res://scripts/infrastructure/audio_library.gd")
|
||||
|
||||
func test_missing_audio_directories_are_silent_for_known_requests() -> void:
|
||||
var library := AudioLibrary.new("res://tests/fixtures/missing-dcwascii")
|
||||
add_child_autofree(library)
|
||||
|
||||
library.set_ambience_context("exploration")
|
||||
library.play_sfx("attack_given")
|
||||
|
||||
assert_eq(library.current_ambience_context, "exploration")
|
||||
assert_eq(library.get_last_ambience_path(), "")
|
||||
assert_eq(library.get_last_sfx_path(), "")
|
||||
assert_false(library.has_playable_ambience())
|
||||
assert_false(library.has_playable_sfx())
|
||||
|
||||
func test_unknown_requests_are_silent() -> void:
|
||||
var library := AudioLibrary.new("res://tests/fixtures/missing-dcwascii")
|
||||
add_child_autofree(library)
|
||||
|
||||
library.set_ambience_context("exploration")
|
||||
library.set_ambience_context("unknown")
|
||||
library.play_sfx("unknown")
|
||||
|
||||
assert_eq(library.current_ambience_context, "exploration")
|
||||
assert_eq(library.get_last_ambience_path(), "")
|
||||
assert_eq(library.get_last_sfx_path(), "")
|
||||
assert_false(library.has_playable_ambience())
|
||||
assert_false(library.has_playable_sfx())
|
||||
|
||||
func test_nominal_and_invalid_wavs_are_discovered_but_never_playable() -> void:
|
||||
var root := ProjectSettings.globalize_path("user://s4-external-audio-library")
|
||||
var nominal_path := root.path_join("audio/exploration/silence.wav")
|
||||
var invalid_path := root.path_join("sfx/attack_given/not-a-wave.wav")
|
||||
DirAccess.make_dir_recursive_absolute(nominal_path.get_base_dir())
|
||||
DirAccess.make_dir_recursive_absolute(invalid_path.get_base_dir())
|
||||
var nominal_file := FileAccess.open(nominal_path, FileAccess.WRITE)
|
||||
nominal_file.store_buffer(PackedByteArray([
|
||||
82, 73, 70, 70, 36, 0, 0, 0, 87, 65, 86, 69, 102, 109, 116, 32,
|
||||
16, 0, 0, 0, 1, 0, 1, 0, 68, 172, 0, 0, 136, 88, 1, 0,
|
||||
2, 0, 16, 0, 100, 97, 116, 97, 0, 0, 0, 0,
|
||||
]))
|
||||
nominal_file.close()
|
||||
var invalid_file := FileAccess.open(invalid_path, FileAccess.WRITE)
|
||||
invalid_file.store_string("this is not a WAV file")
|
||||
invalid_file.close()
|
||||
var library := AudioLibrary.new(root)
|
||||
add_child_autofree(library)
|
||||
|
||||
library.set_ambience_context("exploration")
|
||||
library.play_sfx("attack_given")
|
||||
|
||||
assert_eq(library.get_last_ambience_path(), nominal_path)
|
||||
assert_eq(library.get_last_sfx_path(), invalid_path)
|
||||
assert_false(library.has_playable_ambience())
|
||||
assert_false(library.has_playable_sfx())
|
||||
@@ -0,0 +1 @@
|
||||
uid://dso6tpksr7kjr
|
||||
@@ -0,0 +1,24 @@
|
||||
extends GutTest
|
||||
|
||||
const GameScene = preload("res://scenes/Game.tscn")
|
||||
var game: Game
|
||||
|
||||
func before_each() -> void:
|
||||
game = GameScene.instantiate()
|
||||
add_child_autofree(game)
|
||||
await get_tree().process_frame
|
||||
|
||||
func test_combat_routes_damage_feedback_and_exposes_current_target_summary() -> void:
|
||||
var hud := game.get_node("HUD") as GameHud
|
||||
var player_view := game.get_node("World/Player") as ActorView
|
||||
var enemy_view := game.get_node("World/Enemies/Goblin") as ActorView
|
||||
|
||||
assert_eq(hud.combat_summary, "Target: Goblin HP: 6/6")
|
||||
game.submit_test_action(Vector2i.RIGHT)
|
||||
assert_eq(player_view.last_damage, 2)
|
||||
assert_eq(hud.combat_summary, "Target: Goblin HP: 6/6")
|
||||
|
||||
game.submit_test_action(Vector2i.RIGHT)
|
||||
assert_eq(enemy_view.last_damage, 3)
|
||||
assert_eq(hud.combat_summary, "Target: Goblin HP: 3/6")
|
||||
assert_string_contains(hud.event_log.get_parsed_text(), "You strike the goblin for 3.")
|
||||
@@ -0,0 +1 @@
|
||||
uid://c20kvex2snc0h
|
||||
@@ -0,0 +1,37 @@
|
||||
extends GutTest
|
||||
|
||||
const GameType = preload("res://scripts/game/game.gd")
|
||||
const MapRendererType = preload("res://scripts/presentation/map_renderer.gd")
|
||||
const GameScene = preload("res://scenes/Game.tscn")
|
||||
|
||||
func test_reference_viewport_and_project_window_settings_are_1280_by_720() -> void:
|
||||
assert_eq(GameType.REFERENCE_VIEWPORT, Vector2i(1280, 720))
|
||||
assert_eq(ProjectSettings.get_setting("display/window/size/viewport_width"), 1280)
|
||||
assert_eq(ProjectSettings.get_setting("display/window/size/viewport_height"), 720)
|
||||
assert_eq(ProjectSettings.get_setting("display/window/size/window_width_override"), 1280)
|
||||
assert_eq(ProjectSettings.get_setting("display/window/size/window_height_override"), 720)
|
||||
assert_eq(ProjectSettings.get_setting("display/window/size/resizable"), true)
|
||||
assert_eq(ProjectSettings.get_setting("display/window/stretch/mode"), "canvas_items")
|
||||
|
||||
func test_map_renderer_returns_the_contract_cell_rectangle() -> void:
|
||||
var renderer := MapRendererType.new()
|
||||
add_child_autofree(renderer)
|
||||
|
||||
assert_eq(renderer.get_cell_rect(Vector2i(2, 3)), Rect2(64, 96, 32, 32))
|
||||
|
||||
func test_camera_tracks_player_after_a_valid_action_and_uses_map_limits() -> void:
|
||||
var game := GameScene.instantiate() as Game
|
||||
add_child_autofree(game)
|
||||
await get_tree().process_frame
|
||||
var camera := game.get_node("Camera2D") as Camera2D
|
||||
var state := game.get_game_state()
|
||||
|
||||
assert_eq(camera.position, Vector2(state.player.cell * GameType.TILE_SIZE) + game.get_node("World").position)
|
||||
assert_eq(camera.limit_left, 32)
|
||||
assert_eq(camera.limit_top, 48)
|
||||
assert_eq(camera.limit_right, 416)
|
||||
assert_eq(camera.limit_bottom, 368)
|
||||
|
||||
game.submit_test_action(Vector2i.DOWN)
|
||||
|
||||
assert_eq(camera.position, Vector2(state.player.cell * GameType.TILE_SIZE) + game.get_node("World").position)
|
||||
@@ -0,0 +1 @@
|
||||
uid://cypvomhwmn2qt
|
||||
@@ -0,0 +1 @@
|
||||
uid://k86b33m2hesr
|
||||
Reference in New Issue
Block a user