Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions docs/code-city-brawl.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ Launch Godot 4.7.1 and choose **Beat'em Up → Play Code City Brawl** from the a

The first entry from the hub opens the game's [how-to-play card](main-menu.md#how-to-play-cards) before the opening story scenes; the pause menu's **How to Play** shows it again.

W/Up changes the ground lane. Jump is a separate height above that lane. Attacks have a forward reach and depth tolerance, so standing in another lane avoids melee. Jump above ground attacks and projectiles, or sidestep their telegraphs. Late attack input buffers one next combo step; a gap of more than 0.48 seconds after recovery resets the chain. Hoppy keeps his facing through a swing, so its hit area never flips mid-attack. Pressing the other way during or right after a swing turns him for the next one, buffered combo steps included. A quick tap mid-swing is remembered until the swing ends.
W/Up changes the ground lane. The lanes cover only the paved floor of each district's background: Hoppy, the enemies and the bosses stop just under the railing, fence or balustrade (world y 505 in the CLI / IDE District, 450 in the Security Sector and 465 in Git Repository HQ, down to 650), so nobody walks onto the railing or in front of the skyline. Jump is a separate height above that lane. Attacks have a forward reach and depth tolerance, so standing in another lane avoids melee. Jump above ground attacks and projectiles, or sidestep their telegraphs. Late attack input buffers one next combo step; a gap of more than 0.48 seconds after recovery resets the chain. Hoppy keeps his facing through a swing, so its hit area never flips mid-attack. Pressing the other way during or right after a swing turns him for the next one, buffered combo steps included. A quick tap mid-swing is remembered until the swing ends.

Hoppy has three HP. Coffee restores one HP. Each stage begins with fresh health and equipment. Losing the last HP plays a knockout cinematic, the same in both brawler modes:
- A slow-motion throw under a camera push and letterbox bars, with the HUD, minimap and control hints hidden.
Expand Down Expand Up @@ -145,7 +145,7 @@ Runtime scripts are in `modes/beatem_up/`: `catalog.gd` owns immutable tuning (i
- `victory_screen.gd` counts up the final score on the results screen. Its copy is the catalog's `VICTORY`.
- `minimap.gd` draws the top-right minimap from a per-tick snapshot of the room.

`art.gd` loads shared read-only SpriteFrames, and each armed sheet on first use. Ground-plane geometry drives combat; jump height is separate from Y sorting. Encounters cap enemies at 12, projectiles at 32, warning areas at 12 and pickups at 24.
`art.gd` loads shared read-only SpriteFrames, and each armed sheet on first use. Ground-plane geometry drives combat; jump height is separate from Y sorting. `Catalog.FLOOR_TOP` / `FLOOR_BOTTOM` give each stage's walkable depth band, read off its background's floor line, and `game.gd`'s `clamp_ground()` keeps the player, enemies, spawns, props and both boss kinds inside it. Encounters cap enemies at 12, projectiles at 32, warning areas at 12 and pickups at 24.

```sh
godot --headless --path hoppys-adventure-arcade --import
Expand Down Expand Up @@ -196,7 +196,7 @@ Godot 4.7.1: all 19 headless suites listed in CI passed, including the three Cod

### Weapon animation and boss mobility follow-up

`code_city_motion.gd` checks all six equipped rigs, three-step chaining, mirrored grips, whip extension, hit interruption, shield recoil, boss pursuit/flanking, committed leap targets, landing recovery, bounds, and transition/death cleanup. Its rendered run captures weapon windup/contact/recovery and the boss leap in `docs/previews/code-city-motion/`. The full traversal bot now prioritizes the mobile boss instead of spending every opening on its renewable reinforcements. As before, bot completion is a reachability check with invulnerability, not a difficulty assessment.
`code_city_floor.gd` checks, per district, that the floor band starts under the railing base of its background, that walking up or down and knockback stop at the band's edges, and that wave spawns, props, out-of-band spawns and both boss kinds stay on the floor. `code_city_motion.gd` checks all six equipped rigs, three-step chaining, mirrored grips, whip extension, hit interruption, shield recoil, boss pursuit/flanking, committed leap targets, landing recovery, bounds, and transition/death cleanup. Its rendered run captures weapon windup/contact/recovery and the boss leap in `docs/previews/code-city-motion/`. The full traversal bot now prioritizes the mobile boss instead of spending every opening on its renewable reinforcements. As before, bot completion is a reachability check with invulnerability, not a difficulty assessment.

Follow-up validation: existing Code City logic and asset checks passed; the new motion suite passed headlessly and with rendered pose captures. Both headless and rendered full traversals reached Force Merge with the moving boss. `git diff --check` passed. Difficulty still needs player feedback.

Expand Down
2 changes: 1 addition & 1 deletion hoppys-adventure-arcade/modes/beatem_up/boss.gd
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ func _update_core_cue() -> void:

func arena_point(point: Vector2) -> Vector2:
# Leave room for the boss silhouette and for attacks from either side.
return Vector2(clampf(point.x,arena.room_start()+220,arena.room_start()+1060),clampf(point.y,480,615))
return Vector2(clampf(point.x,arena.room_start()+220,arena.room_start()+1060),clampf(point.y,maxf(480,arena.floor_top()+15),minf(615,arena.floor_bottom()-35)))

func begin_reposition() -> void:
core_cue.hide()
Expand Down
7 changes: 7 additions & 0 deletions hoppys-adventure-arcade/modes/beatem_up/catalog.gd
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
extends RefCounted
const TITLES := ["CLI / IDE DISTRICT", "SECURITY SECTOR", "GIT REPOSITORY HQ"]
const THEMES := ["district", "security", "hq"]
## The walkable depth band of each stage, in world px of its 1280x720 background: the paved
## floor from just under the railing, fence or balustrade base (district 495, security 440,
## HQ 455, plus room for the ground shadow) down to the lowest lane. game.gd's clamp_ground()
## keeps Hoppy, enemies, bosses, props and spawns inside it, so nobody walks onto the railing
## or in front of the skyline.
const FLOOR_TOP := [505.0, 450.0, 465.0]
const FLOOR_BOTTOM := 650.0
const STORIES := ["The terminals have gone dark. Rogue commands are running wild.", "The firewall is down. Injection attacks are flooding the corridors.", "The source repo is under siege. Face the conflict and ship the fix."]
const MUSIC := [
preload("res://Assets/Audio/Beat'em Up/code_city_cli_ide_district.ogg"),
Expand Down
14 changes: 10 additions & 4 deletions hoppys-adventure-arcade/modes/beatem_up/game.gd
Original file line number Diff line number Diff line change
Expand Up @@ -135,8 +135,12 @@ func _ready() -> void:
start_stage(0,true)

func room_start() -> float: return room*1280.0
## This stage's walkable depth band (Catalog.FLOOR_TOP / FLOOR_BOTTOM): the paved floor of its
## background, below the railing. Everything on the ground plane is clamped into it.
func floor_top() -> float: return Catalog.FLOOR_TOP[stage_index]
func floor_bottom() -> float: return Catalog.FLOOR_BOTTOM
func clamp_ground(pos: Vector2) -> Vector2:
return Vector2(clampf(pos.x,room_start()+55,room_start()+(1270 if gate_open else 1150)),clampf(pos.y,455,650))
return Vector2(clampf(pos.x,room_start()+55,room_start()+(1270 if gate_open else 1150)),clampf(pos.y,floor_top(),floor_bottom()))

func start_stage(index: int, cinematic := false) -> void:
ko.cancel()
Expand Down Expand Up @@ -223,8 +227,10 @@ func enter_room(index: int) -> void:
gate.modulate = [Color("76f9dd"),Color("ff8888"),Color("f2c573")][stage_index]
ground.add_child(gate)
var wave: Array = Catalog.WAVES[stage_index][room]
# Three spawn rows spread over the stage's floor band, inset from both edges.
var row_step := (floor_bottom()-floor_top()-50.0)/2.0
for i in wave.size():
spawn_enemy(wave[i],Vector2(room_start()+650+i*110,485+(i%3)*67))
spawn_enemy(wave[i],Vector2(room_start()+650+i*110,floor_top()+25.0+(i%3)*row_step))
spawn_prop(["kiosk","server","pillar"][stage_index],Vector2(room_start()+360,480),0)
spawn_prop(["ide","crate","scaffolding"][stage_index],Vector2(room_start()+920,625),1)
if stage_index==0 and room==0: drop("debug_stick",Vector2(290,590))
Expand All @@ -242,7 +248,7 @@ func spawn_enemy(kind: String, pos: Vector2, split := true) -> Node2D:
var enemy := Enemy.new()
enemy.arena = self
enemy.kind = kind
enemy.position = pos
enemy.position = clamp_ground(pos)
enemy.can_split = split
actors.add_child(enemy)
enemies.append(enemy)
Expand Down Expand Up @@ -320,7 +326,7 @@ static func melee_contains(offset: Vector2, facing: float, reach: float, depth:

func spawn_prop(kind: String, pos: Vector2, slot: int) -> void:
var node := Node2D.new()
node.position = pos
node.position = clamp_ground(pos)
var sprite := Art.sprite(Catalog.THEMES[stage_index]+"_kit",kind+"_intact",1.25,false)
sprite.position.y = -58
node.add_child(sprite)
Expand Down
9 changes: 6 additions & 3 deletions hoppys-adventure-arcade/modes/beatem_up/mini_boss.gd
Original file line number Diff line number Diff line change
Expand Up @@ -155,9 +155,12 @@ func _tick_active(dt: float) -> void:
var wall: float = arena.room_start()+(1160.0 if dash_direction > 0 else 120.0)
if timer <= 0 or absf(position.x-wall) < 1: _recover()

## Leave room for the boss's silhouette and for attacks from either side.
## Leave room for the boss's silhouette and for attacks from either side, inside the stage's
## floor band so it never climbs onto the railing.
func arena_point(point: Vector2) -> Vector2:
return Vector2(clampf(point.x,arena.room_start()+120,arena.room_start()+1160),clampf(point.y,470,630))
return Vector2(clampf(point.x,arena.room_start()+120,arena.room_start()+1160),clampf(point.y,depth_top(),depth_bottom()))
func depth_top() -> float: return arena.floor_top()+10.0
func depth_bottom() -> float: return arena.floor_bottom()-20.0

## The tells shorten once it is enraged.
func tell_time(kind: String) -> float:
Expand All @@ -177,7 +180,7 @@ func telegraph() -> void:
# The warning fires on landing, after the tell and the flight.
arena.ground_warning(aim,SLAM_RADIUS,timer+float(data.leap),.25,"slam",self)
else:
aim = Vector2(position.x,clampf(player.position.y,470,630))
aim = Vector2(position.x,clampf(player.position.y,depth_top(),depth_bottom()))
dash_direction = 1.0 if player.position.x >= position.x else -1.0
pose("dash_warning")
for n in 3:
Expand Down
93 changes: 93 additions & 0 deletions hoppys-adventure-arcade/tests/code_city_floor.gd
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
extends SceneTree
## Code City Brawl's walkable depth band is the paved floor of each stage's background: Hoppy,
## enemies, spawns and bosses stay below the railing, fence or balustrade (Catalog.FLOOR_TOP).
const Catalog = preload("res://modes/beatem_up/catalog.gd")
const Boss = preload("res://modes/beatem_up/boss.gd")
const DT := 1.0/60.0
## Where each background's railing base ends (world px), read off the art; the band starts below.
const ART_FLOOR_LINE := [495.0, 440.0, 455.0]
var failures := 0
var game
func _initialize() -> void: call_deferred("run")
func check(ok: bool, message: String) -> void:
print("PASS: " if ok else "FAIL: ",message)
if not ok: failures += 1
func frames(n: int) -> void:
for i in n: await physics_frame
func freeze() -> void:
game.set_physics_process(false)
game.player.set_physics_process(false)
for e in game.enemies: e.set_physics_process(false)
if is_instance_valid(game.boss): game.boss.set_physics_process(false)
## Hold a depth direction for `seconds` of player ticks and return where Hoppy ends up.
func drive(action: String, seconds: float) -> Vector2:
var p = game.player
p.controlled = true
p.input_lock = 0
p.stagger = 0
p.knock = Vector2.ZERO
Input.action_press(action)
for i in int(seconds/DT): p.tick(DT)
Input.action_release(action)
p.tick(DT)
return p.position
func run() -> void:
change_scene_to_file("res://scenes/beatem_up/code_city_brawl.tscn")
await process_frame
await process_frame
await frames(5)
game = current_scene
game.test_mode = true
paused = false
if game.state == "paused": game.resume()
freeze()
check(Catalog.FLOOR_TOP.size() == Catalog.THEMES.size(), "Every stage theme has a floor line")
for stage in Catalog.THEMES.size():
var top: float = Catalog.FLOOR_TOP[stage]
var bottom: float = Catalog.FLOOR_BOTTOM
var label: String = Catalog.THEMES[stage]
check(top > ART_FLOOR_LINE[stage] and bottom > top + 100 and bottom <= 720, "%s: the band is on the paved floor, under the railing base" % label)
game.start_stage(stage)
await process_frame
freeze()
check(game.stage_index == stage and is_equal_approx(game.floor_top(), top), "%s: the stage reports its floor line" % label)
check(game.clamp_ground(Vector2(640, 0)).y == top and game.clamp_ground(Vector2(640, 9999)).y == bottom, "%s: clamp_ground keeps the ground plane in the band" % label)
for e in game.enemies:
check(e.position.y >= top and e.position.y <= bottom, "%s: %s spawns on the floor at y=%d" % [label, e.kind, int(e.position.y)])
var spawned = game.spawn_enemy("cli_gremlin", Vector2(game.room_start()+700, 100), false)
check(spawned != null and is_equal_approx(spawned.position.y, top), "%s: a spawn above the floor lands on its edge" % label)
if spawned != null:
spawned.set_physics_process(false)
game.enemies.erase(spawned)
spawned.queue_free()
for prop in game.props:
check(prop.node.position.y >= top and prop.node.position.y <= bottom, "%s: props stand on the floor" % label)
var p = game.player
p.position = Vector2(game.room_start()+640, 580)
p.height = 0; p.rise = 0
var up := drive("move_up", 3.0)
check(is_equal_approx(up.y, top) and p.height == 0, "%s: walking up stops at the floor line (y=%d)" % [label, int(up.y)])
var down := drive("move_down", 3.0)
check(is_equal_approx(down.y, bottom), "%s: walking down stops at the lowest lane" % label)
p.position = Vector2(game.room_start()+640, 580)
# Knockback cannot push Hoppy past the floor line either.
p.knock = Vector2(0, -2000)
p.tick(DT)
check(p.position.y >= top, "%s: knockback keeps Hoppy on the floor" % label)
Comment thread
coderabbitai[bot] marked this conversation as resolved.
Resolved
p.knock = Vector2.ZERO
if Catalog.MINI_BOSS_STAGES[stage] != "":
game.call_mini_boss()
await process_frame
game.boss.set_physics_process(false)
var spot: Vector2 = game.boss.arena_point(Vector2(game.room_start()+640, 0))
check(spot.y >= top and game.boss.position.y >= top, "%s: the district boss keeps to the floor" % label)
else:
var boss := Boss.new()
boss.arena = game
var spot: Vector2 = boss.arena_point(Vector2(game.room_start()+640, 0))
check(spot.y >= top and boss.arena_point(Vector2(0, 9999)).y <= bottom, "%s: the Grand Merge Conflict keeps to the floor" % label)
boss.free()
print("Code City floor failures: ",failures)
game.queue_free()
await root.get_node("AudioService").settle()
quit(1 if failures else 0)
1 change: 1 addition & 0 deletions hoppys-adventure-arcade/tests/code_city_floor.gd.uid
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
uid://c3426a100eqdm
Loading