mirror of
https://git.leinelab.org/Mal/mr-crocs-adventures.git
synced 2025-09-11 02:57:36 +02:00
Snow fullscreen effect implemented
This commit is contained in:
13
js/Level.js
13
js/Level.js
@@ -1,5 +1,6 @@
|
||||
import FileLoader from "./FileLoader.js";
|
||||
import Terrain from "../tilorswift/js/Terrain.js";
|
||||
import {FullscreenEffectFactory} from "./effects/FullscreenEffectFactory.js";
|
||||
|
||||
export default class Level
|
||||
{
|
||||
@@ -8,6 +9,7 @@ export default class Level
|
||||
constructor(terrain)
|
||||
{
|
||||
this.terrain = terrain;
|
||||
this.fullscreenEffects = [];
|
||||
this.gravity = 2.0;
|
||||
}
|
||||
|
||||
@@ -83,7 +85,6 @@ export default class Level
|
||||
const json = JSON.parse(data);
|
||||
const level = new Level(Terrain.createFromJson(json));
|
||||
level.setGravity(json.gravity / Level.FACTOR_GRAVITY);
|
||||
|
||||
callback(level);
|
||||
}
|
||||
loader.loadContent();
|
||||
@@ -97,6 +98,16 @@ export default class Level
|
||||
const level = new Level(terrain);
|
||||
level.setGravity(data.gravity / Level.FACTOR_GRAVITY);
|
||||
|
||||
if (data.hasOwnProperty('effects')) {
|
||||
const effectFactory = new FullscreenEffectFactory();
|
||||
|
||||
for (const effect of data.effects) {
|
||||
level.fullscreenEffects.push(
|
||||
effectFactory.getEffect(effect)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
return level;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user