mirror of
https://git.leinelab.org/Mal/mr-crocs-adventures.git
synced 2025-09-11 02:57:36 +02:00
Tileset dialog for Tilorswift and fix for adding rows.
This commit is contained in:
17
js/module.js
17
js/module.js
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user