fix lighting and this one weird bug in player changes when ascending
This commit is contained in:
parent
fc05b00775
commit
9d3912f98f
3 changed files with 8 additions and 5 deletions
3
.gitignore
vendored
3
.gitignore
vendored
|
@ -22,3 +22,6 @@ dist-ssr
|
|||
*.njsproj
|
||||
*.sln
|
||||
*.sw?
|
||||
|
||||
# old source code for reference?!
|
||||
src/old
|
||||
|
|
|
@ -50,7 +50,7 @@ export default function createLevel(width: number, height: number, seed = 'extre
|
|||
if (changes) {
|
||||
const maxLevel = levelOffset + height
|
||||
changes.forEach(c => {
|
||||
if (c.type !== 'exchange' || c.y < levelOffset || c.y > maxLevel) return
|
||||
if (c.type !== 'exchange' || c.y < levelOffset || c.y >= maxLevel) return
|
||||
_grid[c.y - levelOffset][c.x - columnOffset] = blockTypes[c.newType]
|
||||
})
|
||||
}
|
||||
|
|
|
@ -58,11 +58,8 @@ export default function useLightMap(
|
|||
function drawLights() {
|
||||
// used for everything above ground
|
||||
const ambientLight = getAmbientLightColor()
|
||||
const reflectedLight = ambientLight.slice(0, -1) + ', 50%)'
|
||||
const surroundingLight = ambientLight.slice(-2)
|
||||
const barrier = lightBarrier.value
|
||||
// make light columns wider to illuminate surrounding blocks
|
||||
const extra = Math.floor(B / 2)
|
||||
|
||||
ctx.fillStyle = ambientLight
|
||||
for (let col = 0; col < W / B; col++) {
|
||||
|
@ -75,8 +72,11 @@ export default function useLightMap(
|
|||
ctx.fillRect(sx, sy, sw, sh)
|
||||
}
|
||||
|
||||
// make light columns wider to illuminate surrounding blocks
|
||||
const extra = Math.floor(B / 2)
|
||||
const reflectedLight = ambientLight.slice(0, -1) + ', 50%)'
|
||||
ctx.fillStyle = reflectedLight
|
||||
for (let col = 0; col < W / B; col+=2) {
|
||||
for (let col = 0; col < W / B; col++) {
|
||||
const level = (barrier[col] - y.value) * B
|
||||
const sw = B
|
||||
const sh = level
|
||||
|
|
Loading…
Reference in a new issue