wlall
This commit is contained in:
@@ -121,8 +121,6 @@ class DungeonCrawler {
|
||||
|
||||
this.setupControls();
|
||||
this.loadMap();
|
||||
this.render(this.player.x, this.player.y, this.player.orientation * PI_OVER_TWO);
|
||||
this.renderCompass();
|
||||
|
||||
//
|
||||
// Start the game loop
|
||||
@@ -173,13 +171,12 @@ class DungeonCrawler {
|
||||
textureUrls.forEach((url, textureId) => {
|
||||
Texture.fromSource(url).then((texture) => {
|
||||
textures[textureId] = texture;
|
||||
|
||||
if (textureLoadCount > textureUrls.length) {
|
||||
return;
|
||||
}
|
||||
|
||||
console.log("here", { textureId, texture, textures });
|
||||
textureLoadCount++;
|
||||
|
||||
if (textureLoadCount < textureUrls.length) {
|
||||
return;
|
||||
}
|
||||
this.rendering.firstPersonRenderer = new FirstPersonRenderer(
|
||||
this.rendering.firstPersonWindow,
|
||||
this.map,
|
||||
@@ -188,8 +185,9 @@ class DungeonCrawler {
|
||||
);
|
||||
this.render();
|
||||
this.renderMinimap();
|
||||
this.renderCompass();
|
||||
|
||||
console.debug("renderer ready", texture);
|
||||
console.debug("renderer ready", textures);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
@@ -397,21 +397,13 @@ export class FirstPersonRenderer {
|
||||
// appear first in the array,
|
||||
// enabling us to simply draw from back to front
|
||||
const collision = new RayCollision();
|
||||
result.collisions.unshift(collision);
|
||||
|
||||
collision.mapX = mapX;
|
||||
collision.mapY = mapY;
|
||||
collision.rayLength = rayLength;
|
||||
collision.tile = tile;
|
||||
collision.sampleU = sampleU;
|
||||
collision.side = side;
|
||||
if (result.sprite) {
|
||||
collision.sprite = true;
|
||||
}
|
||||
if (result.wall) {
|
||||
collision.wall = true;
|
||||
return;
|
||||
}
|
||||
result.collisions.unshift(collision);
|
||||
}
|
||||
|
||||
//
|
||||
@@ -421,17 +413,6 @@ export class FirstPersonRenderer {
|
||||
// --------------------------
|
||||
if (tile.wall) {
|
||||
result.hitWall = true;
|
||||
|
||||
// <todo>
|
||||
// DELETE BELOW
|
||||
result.wallCollision.tile = tile;
|
||||
result.wallCollision.side = side;
|
||||
|
||||
result.wallCollision.mapX = mapX;
|
||||
result.wallCollision.mapY = mapY;
|
||||
result.wallCollision.rayLength = rayLength;
|
||||
result.wallCollision.sampleU = sampleU;
|
||||
// </todo>
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -32,6 +32,10 @@ export class Tile {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
get isCollision() {
|
||||
return this.wall || this.sprite;
|
||||
}
|
||||
}
|
||||
|
||||
export const defaultLegend = Object.freeze({
|
||||
|
||||
Reference in New Issue
Block a user