Tileset dialog for Tilorswift and fix for adding rows.

This commit is contained in:
Mal
2020-02-14 00:12:24 +01:00
parent 72589544bd
commit 04c3d0253b
19 changed files with 297 additions and 52 deletions

View File

@@ -7,8 +7,8 @@ import FileLoader from "./FileLoader.js";
import Camera from "./Camera.js";
import Gisela from "./Gisela.js";
import Setting from "./Setting.js";
import InterfaceEvent from "./events/InterfaceEvent.js";
import FrameRateMeasurer from "./FrameRateMeasurer.js";
import GraphicSet from "./GraphicSet.js";
class ImageLoader
{
@@ -160,7 +160,7 @@ const GRAVITY = 2;
let fps;
let frameDuration;
let levelJson = new FileLoader('levels/level01.json');
let levelJson = new FileLoader('levels/moon.json');
const LEVEL = JSON.parse(levelJson.getContent());
@@ -180,7 +180,7 @@ let loader = new ImageLoader();
loader.addImage(Setting.GRAPHICS_LOCATION + 'mr-croc-walk-right.png');
loader.addImage(Setting.GRAPHICS_LOCATION + 'mr-croc-walk-left.png');
loader.addImage(Setting.TILESET_LOCATION + 'landscape01.jpg');
loader.addImage(Setting.TILESET_LOCATION + GraphicSet[LEVEL.tileset].tileset);
loader.addImage(Setting.GRAPHICS_LOCATION + 'gisela-right.png');
new FrameRateMeasurer();
@@ -191,6 +191,15 @@ window.addEventListener(
let canvas = document.getElementById('canvas');
canvas.width = window.innerWidth;
canvas.height = window.innerHeight;
canvas.style.backgroundAttachment = 'fixed';
canvas.style.backgroundSize = 'cover';
canvas.style.backgroundPosition = 'center center';
if (GraphicSet[LEVEL.tileset].backgroundImage !== null) {
canvas.style.backgroundImage = 'url("' + Setting.GRAPHICS_LOCATION + GraphicSet[LEVEL.tileset].backgroundImage +'")';
}
canvas.style.backgroundColor = LEVEL.backgroundColor;
window.addEventListener(
'resize',
@@ -212,7 +221,7 @@ window.addEventListener(
gisela = new Gisela();
architecture.setMovableToTargetPosition(gisela);
fps = 120; //event.frameRate;
fps = 120;
frameDuration = 1000 / fps;
window.requestAnimationFrame(MainLoop);
}