Skip to content

Expand rooms to 2× viewport width and add enemy patrol movement#4

Merged
LloydNicholson merged 2 commits into
copilot/rewrite-project-in-godotfrom
copilot/fix-scene-size-and-enemy-movement
Mar 21, 2026
Merged

Expand rooms to 2× viewport width and add enemy patrol movement#4
LloydNicholson merged 2 commits into
copilot/rewrite-project-in-godotfrom
copilot/fix-scene-size-and-enemy-movement

Conversation

Copy link
Copy Markdown

Copilot AI commented Mar 21, 2026

The game rooms were exactly the size of the viewport (384×216), leaving no space for the camera to scroll and making the 64×64 player fill ~30% of screen height. Enemies had no movement logic.

Enemy patrol (Enemy.gd)

  • Added x_min, x_max, speed exports matching the MovingBlock pattern
  • _physics_process shuttles the enemy between bounds; sprite flips on reversal
  • @onready var _sprite replaces fragile $Sprite inline references
@export var x_min: float = 0.0
@export var x_max: float = 100.0
@export var speed: float = 60.0

func _physics_process(delta: float) -> void:
    position.x += speed * _direction * delta
    if position.x >= x_max:
        _direction = -1
        _sprite.flip_h = true
    elif position.x <= x_min:
        _direction = 1
        _sprite.flip_h = false

Room expansion (Room0.tscn, Room1.tscn)

  • Both rooms expanded 384 → 768 px wide (2× viewport, matching original GameMaker room-to-view ratio)
  • Right wall moved x=376 → x=760; floor widened to 768 px
  • Second half of each room populated with 3 new platforms, 3 diamonds, 1–2 additional patrolling enemies, and a second moving block
  • Camera limits (limit_left=0, limit_right=768, limit_top=0, limit_bottom=216) set per room so the camera scrolls without showing outside bounds

Camera clamping (GameCamera.gd)

Lerp target is clamped to the camera's limit bounds before applying, preventing rubber-banding near room edges:

var tx := clampf(_target.global_position.x, limit_left + half.x, limit_right - half.x)
var ty := clampf(_target.global_position.y, limit_top + half.y, limit_bottom - half.y)
global_position = global_position.lerp(Vector2(tx, ty), lerp_speed)

Death area (DeathArea.tscn)

Collision shape widened 384 → 2000 px so a single instance covers any room size.

Original prompt

Pull request: #3

The assets are now loading and movement feels better but the scene is too small compared to the player. None of the enemies are moving but I have a feeling it's because of th scene size


🔒 GitHub Advanced Security automatically protects Copilot coding agent pull requests. You can protect all pull requests by enabling Advanced Security for your repositories. Learn more about Advanced Security.

Copilot AI changed the title [WIP] Fix scene size and enable enemy movement Expand rooms to 2× viewport width and add enemy patrol movement Mar 21, 2026
Copilot AI requested a review from LloydNicholson March 21, 2026 13:06
@LloydNicholson LloydNicholson marked this pull request as ready for review March 21, 2026 13:11
@LloydNicholson LloydNicholson merged commit afffb21 into copilot/rewrite-project-in-godot Mar 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants