-
Notifications
You must be signed in to change notification settings - Fork 3
fix: prevent hero sprite from rendering over solid walls (#16) #51
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -31,6 +31,7 @@ | |
|
|
||
| const { style } = require('bare-tui') | ||
| const { makeMovingHeroSprite } = require('./sprites.js') | ||
| const { isSolid } = require('./map.js') | ||
| const { WORLD_BOSS } = require('./world-boss.js') | ||
| const { bossCamera } = require('./world-boss-event.js') | ||
|
|
||
|
|
@@ -861,7 +862,10 @@ function mapPane(map, w, h, opts = {}) { | |
| while (last > first && line[last] === ' ') last-- | ||
| for (let sx = first; sx <= last; sx++) { | ||
| if (line[sx] === ' ') continue | ||
| const cell = top + sy + ',' + (left + sx) | ||
| const wx = left + sx | ||
| const wy = top + sy | ||
| if (isSolid({ rows: tiles, width: mapW, height: mapH }, wx, wy)) continue | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 💡 Edge Case: Displaced actors in mapPane are not wall-checked and may clip wallsThe new displacement logic (lines 775-801) reassigns Was this helpful? React with 👍 / 👎 |
||
| const cell = wy + ',' + wx | ||
| over.set(cell, line[sx]) | ||
| heroCells.add(cell) | ||
| } | ||
|
|
@@ -1396,7 +1400,6 @@ function compose(opts) { | |
| function mapScreen(m) { | ||
| const tiles = (m.map && m.map.tiles) || [] | ||
| const cellW = Math.max(1, m.cellW || CELL_W) | ||
| const mapW = tiles.reduce((widest, line) => Math.max(widest, String(line).length), 0) * cellW | ||
| // Large maps scroll inside the pane. Requiring the entire map to fit would | ||
| // hide the character sheet forever as soon as a world grew beyond one view. | ||
| const sidebar = m.sidebar === undefined ? m.width >= 64 : m.sidebar | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.