Attempting to add some light
This commit is contained in:
parent
1bb9448408
commit
730bfbe568
@ -12,7 +12,7 @@ class Player extends TileSprite {
|
|||||||
|
|
||||||
this.rate = {
|
this.rate = {
|
||||||
walking: 0.2,
|
walking: 0.2,
|
||||||
running: 0.08
|
running: 0.1
|
||||||
};
|
};
|
||||||
|
|
||||||
this.anims = new AnimManager(this);
|
this.anims = new AnimManager(this);
|
||||||
|
11
src/game.js
11
src/game.js
@ -1,7 +1,7 @@
|
|||||||
const { ipcRenderer, remote } = require("electron");
|
const { ipcRenderer, remote } = require("electron");
|
||||||
|
|
||||||
var asdf = require("asdf-games");
|
var asdf = require("asdf-games");
|
||||||
const { Game, KeyControls, MouseControls, Camera } = asdf;
|
const { Game, KeyControls, MouseControls, Camera, Lighting } = asdf;
|
||||||
|
|
||||||
const window = { w: 640, h: 320 };
|
const window = { w: 640, h: 320 };
|
||||||
|
|
||||||
@ -18,12 +18,19 @@ const keys = new KeyControls();
|
|||||||
|
|
||||||
var level = new Level();
|
var level = new Level();
|
||||||
var player = new Player(keys, window, level);
|
var player = new Player(keys, window, level);
|
||||||
|
var lightsources = [
|
||||||
|
{ x: 100, y: 100 },
|
||||||
|
{ x: 300, y: 100 },
|
||||||
|
{ x: 500, y: 100 },
|
||||||
|
{ x: 500, y: 300 }
|
||||||
|
];
|
||||||
|
var lighting = new Lighting(level.x, level.y, level.w, level.h, lightsources);
|
||||||
const camera = new Camera(player, window, { w: level.w * 2, h: level.h * 2 });
|
const camera = new Camera(player, window, { w: level.w * 2, h: level.h * 2 });
|
||||||
|
|
||||||
scene.add(camera);
|
scene.add(camera);
|
||||||
camera.add(level);
|
camera.add(level);
|
||||||
camera.add(player);
|
camera.add(player);
|
||||||
|
camera.add(lighting);
|
||||||
|
|
||||||
game.run(() => {
|
game.run(() => {
|
||||||
if (mouseAim.isDown) {
|
if (mouseAim.isDown) {
|
||||||
|
@ -10,8 +10,8 @@ const levelSize = { w: 960, h: 480 };
|
|||||||
var levelData = [
|
var levelData = [
|
||||||
0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 4, 5,
|
0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 4, 5,
|
||||||
3, 20, 21, 22, 20, 21, 22, 20, 21, 22, 20, 21, 22, 20, 21, 22, 20, 21, 22, 20, 21, 22, 20, 21, 22, 20, 21, 22, 20, 6,
|
3, 20, 21, 22, 20, 21, 22, 20, 21, 22, 20, 21, 22, 20, 21, 22, 20, 21, 22, 20, 21, 22, 20, 21, 22, 20, 21, 22, 20, 6,
|
||||||
3, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 6,
|
3, 16, 16, 16, 16, 20, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 6,
|
||||||
3, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 6,
|
3, 16, 16, 16, 16, 20, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 6,
|
||||||
3, 16, 16, 16, 16, 20, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 6,
|
3, 16, 16, 16, 16, 20, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 6,
|
||||||
3, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 6,
|
3, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 6,
|
||||||
3, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 6,
|
3, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 6,
|
||||||
|
Loading…
Reference in New Issue
Block a user