mirror of
https://git.leinelab.org/Mal/mr-crocs-adventures.git
synced 2025-09-11 02:57:36 +02:00
Loading of levels is working now
This commit is contained in:
@@ -204,10 +204,10 @@ export default class RetroArchitecture
|
||||
|
||||
draw(context, camera = new Camera())
|
||||
{
|
||||
let viewX = parseInt(Math.floor(Math.max(0, camera.position.x) / this.tileWidth));
|
||||
let viewWidth = parseInt(Math.min(Math.ceil(camera.width), this.columns));
|
||||
let viewY = parseInt(Math.floor(Math.max(0, camera.position.y)) / this.tileHeight);
|
||||
let viewHeight = parseInt(Math.min(Math.ceil(camera.height), this.rows));
|
||||
const viewX = parseInt(Math.floor(Math.max(0, camera.position.x) / this.tileWidth));
|
||||
const viewWidth = parseInt(Math.min(Math.ceil(camera.width), this.columns));
|
||||
const viewY = parseInt(Math.floor(Math.max(0, camera.position.y)) / this.tileHeight);
|
||||
const viewHeight = parseInt(Math.min(Math.ceil(camera.height), this.rows));
|
||||
|
||||
for (let y = viewY; y < viewHeight; y++) {
|
||||
for (let x = viewX; x < viewWidth; x++) {
|
||||
@@ -235,6 +235,11 @@ export default class RetroArchitecture
|
||||
);
|
||||
}
|
||||
|
||||
getStartPosition()
|
||||
{
|
||||
return new GeometryPoint(this.startX * this.tileWidth, this.startY * this.tileHeight);
|
||||
}
|
||||
|
||||
static createFromData(level)
|
||||
{
|
||||
let graphicSet = GraphicSet[level.getTilesetId()];
|
||||
|
||||
Reference in New Issue
Block a user