Jump to content
Main menu
Main menu
move to sidebar
hide
Navigation
Main page
Recent changes
Random page
freem
Search
Search
Appearance
Create account
Log in
Personal tools
Create account
Log in
Pages for logged out editors
learn more
Contributions
Talk
Editing
Openai/694f5245-1110-800b-b182-7c2accd50046
(section)
Add languages
Page
Discussion
English
Read
Edit
Edit source
View history
Tools
Tools
move to sidebar
hide
Actions
Read
Edit
Edit source
View history
General
What links here
Related changes
Special pages
Page information
Appearance
move to sidebar
hide
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
==== 把下面整段貼給 GEMINI: ==== <syntaxhighlight lang="text">PATCH 2.1 / Regression Fix: Facing reversed + Room AREA broken (Isometric) Goal: * Prevent recurring regressions by enforcing a strict rule: ALL gameplay logic uses WORLD or TILE coordinates only. Screen/isometric projection is rendering-only. A) Fix facing reversal (mouse aim) * Do NOT decide facing using mouseX screen coords directly. * Convert mouse screen position to aimWorld (inverse isometric projection), then: faceLeft if (aimWorld.x < playerWorld.x) faceRight otherwise * Inverse iso (with camera offset): sx = mouseX - camX sy = mouseY - camY worldX = ( sy/(tileH/2) + sx/(tileW/2) ) / 2 worldY = ( sy/(tileH/2) - sx/(tileW/2) ) / 2 * Ensure sprite mirroring is applied in ONE place only (avoid double-flip): e.g., drawImage with scaleX = -1 OR choose mirrored frame, not both. Debug (F2): * Show: playerWorld.x, playerWorld.y * Show: aimWorld.x, aimWorld.y * Show: facing = LEFT/RIGHT Acceptance: * Aim mouse left of player => mech faces left (always). * Aim mouse right of player => mech faces right (always). B) Fix room AREA / exit trigger (after isometric changes) * Exit triggers MUST be computed in WORLD/TILE coords, never screen coords. * Best practice: define room size in TILE grid: roomTilesW, roomTilesH playerTile = worldToTile(playerWorld) * Exit margins in tiles (e.g. 1~2 tiles): if playerTile.x <= 0 + margin => LEFT exit if playerTile.x >= roomTilesW-1 - margin => RIGHT exit if playerTile.y <= 0 + margin => UP exit if playerTile.y >= roomTilesH-1 - margin => DOWN exit * Only render exit indicators for exits that exist in the room graph. Debug (F1): * Show current room coords (rx, ry) * Show playerTile (tx, ty) * Show roomTilesW/H and margin * Print when trigger fires: "ENTER EXIT: LEFT/RIGHT/UP/DOWN" Acceptance: * Walking to an exit edge triggers transition reliably within 3 seconds. * Indicators match actual exits (no fake arrows). C) Regression guardrails (important) * Never mix screenX/screenY into collision, exit, or facing logic. * Keep a single source of truth: playerWorld, enemyWorld, bulletWorld, roomGraph in world/tile space. </syntaxhighlight>
Summary:
Please note that all contributions to freem are considered to be released under the Creative Commons Attribution-ShareAlike 4.0 (see
Freem:Copyrights
for details). If you do not want your writing to be edited mercilessly and redistributed at will, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource.
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)