Finish adding all entities
This commit is contained in:
parent
558e91a442
commit
66b29967e1
BIN
assets/.DS_Store
vendored
BIN
assets/.DS_Store
vendored
Binary file not shown.
BIN
assets/image/.DS_Store
vendored
BIN
assets/image/.DS_Store
vendored
Binary file not shown.
Before Width: | Height: | Size: 310 B After Width: | Height: | Size: 310 B |
BIN
assets/image/water.png
Normal file
BIN
assets/image/water.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 367 B |
8
src/bootstrap.js
vendored
8
src/bootstrap.js
vendored
@ -21,11 +21,11 @@ game.bootstrap = (() => {
|
|||||||
{
|
{
|
||||||
src: [
|
src: [
|
||||||
'src/entities/bigblue.js', 'src/entities/flag.js', 'src/entities/floor.js', 'src/entities/grass.js', 'src/entities/hedge.js',
|
'src/entities/bigblue.js', 'src/entities/flag.js', 'src/entities/floor.js', 'src/entities/grass.js', 'src/entities/hedge.js',
|
||||||
'src/entities/liquid.js', 'src/entities/rock.js', 'src/entities/wall.js', 'src/entities/wordBigBlue.js',
|
'src/entities/lava.js', 'src/entities/rock.js', 'src/entities/wall.js', 'src/entities/wordBigBlue.js',
|
||||||
'src/entities/wordFlag.js', 'src/entities/wordIs.js', 'src/entities/wordKill.js', 'src/entities/wordLava.js',
|
'src/entities/wordFlag.js', 'src/entities/wordIs.js', 'src/entities/wordKill.js', 'src/entities/wordLava.js',
|
||||||
'src/entities/wordPush.js', 'src/entities/wordRock.js', 'src/entities/wordSink.js', 'src/entities/wordStop.js',
|
'src/entities/wordPush.js', 'src/entities/wordRock.js', 'src/entities/wordSink.js', 'src/entities/wordStop.js',
|
||||||
'src/entities/wordWall.js', 'src/entities/wordWater.js', 'src/entities/wordWin.js', 'src/entities/wordYou.js',
|
'src/entities/wordWall.js', 'src/entities/wordWater.js', 'src/entities/wordWin.js', 'src/entities/wordYou.js',
|
||||||
'src/entities/borderParticles.js'
|
'src/entities/borderParticles.js', 'src/entities/water.js'
|
||||||
],
|
],
|
||||||
id: 'entities'
|
id: 'entities'
|
||||||
},
|
},
|
||||||
@ -39,10 +39,10 @@ game.bootstrap = (() => {
|
|||||||
];
|
];
|
||||||
const assets = {};
|
const assets = {};
|
||||||
[
|
[
|
||||||
"bigblue", "flag", "floor", "grass", "hedge", "liquid", "rock",
|
"bigblue", "flag", "floor", "grass", "hedge", "lava", "rock",
|
||||||
"wall", "wordBigBlue", "wordFlag", "wordIs", "wordKill", "wordLava",
|
"wall", "wordBigBlue", "wordFlag", "wordIs", "wordKill", "wordLava",
|
||||||
"wordPush", "wordRock", "wordSink", "wordStop", "wordWall", "wordWater",
|
"wordPush", "wordRock", "wordSink", "wordStop", "wordWall", "wordWater",
|
||||||
"wordWin", "wordYou"
|
"wordWin", "wordYou", "water"
|
||||||
].map((x) => assets[x] = `assets/image/${x}.png`);
|
].map((x) => assets[x] = `assets/image/${x}.png`);
|
||||||
[
|
[
|
||||||
"background-music", "death", "move", "win"
|
"background-music", "death", "move", "win"
|
||||||
|
15
src/entities/lava.js
Normal file
15
src/entities/lava.js
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
game.createLava = () => {
|
||||||
|
// TODO: Split this into two entities: water and lava
|
||||||
|
const lava = game.Entity();
|
||||||
|
lava.addComponent(game.components.LoadPriority({priority: 5}));
|
||||||
|
lava.addComponent(game.components.Appearance({rot: 0, width: 100, height: 100}));
|
||||||
|
lava.addComponent(game.components.Alive());
|
||||||
|
lava.sprite = game.graphics.Sprite({
|
||||||
|
image: game.assets.lava,
|
||||||
|
spriteHeight: 24,
|
||||||
|
spriteWidth: 24,
|
||||||
|
numFrames: 3,
|
||||||
|
timePerFrame: 100,
|
||||||
|
});
|
||||||
|
return lava;
|
||||||
|
}
|
@ -1,16 +0,0 @@
|
|||||||
game.createLiquid = () => {
|
|
||||||
// TODO: Split this into two entities: water and lava
|
|
||||||
const liquid = game.Entity();
|
|
||||||
liquid.addComponent(game.components.LoadPriority({priority: 5}));
|
|
||||||
liquid.addComponent(game.components.Position({x: 0, y: 0}));
|
|
||||||
liquid.addComponent(game.components.Appearance({rot: 0, width: 100, height: 100}));
|
|
||||||
liquid.addComponent(game.components.Alive());
|
|
||||||
liquid.sprite = game.graphics.Sprite({
|
|
||||||
image: game.assets.liquid,
|
|
||||||
spriteHeight: 24,
|
|
||||||
spriteWidth: 24,
|
|
||||||
numFrames: 3,
|
|
||||||
timePerFrame: 100,
|
|
||||||
});
|
|
||||||
return liquid;
|
|
||||||
}
|
|
14
src/entities/water.js
Normal file
14
src/entities/water.js
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
game.createWater = () => {
|
||||||
|
const water = game.Entity();
|
||||||
|
water.addComponent(game.components.LoadPriority({priority: 5}));
|
||||||
|
water.addComponent(game.components.Appearance({rot: 0, width: 100, height: 100}));
|
||||||
|
water.addComponent(game.components.Alive());
|
||||||
|
water.sprite = game.graphics.Sprite({
|
||||||
|
image: game.assets.water,
|
||||||
|
spriteHeight: 24,
|
||||||
|
spriteWidth: 24,
|
||||||
|
numFrames: 3,
|
||||||
|
timePerFrame: 100,
|
||||||
|
});
|
||||||
|
return water;
|
||||||
|
}
|
@ -21,7 +21,7 @@ game.loop = (timeStamp) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
game.initialize = () => {
|
game.initialize = () => {
|
||||||
[game.entities, game.config] = game.loadLevel(game.levels[0]);
|
[game.entities, game.config] = game.loadLevel(game.levels[4]);
|
||||||
|
|
||||||
// Maintained by gridSystem as a side-effect
|
// Maintained by gridSystem as a side-effect
|
||||||
game.entitiesGrid = Array(game.config.yDim).fill(null).map(() => Array(game.config.xDim).fill(null).map(() => new Map()));
|
game.entitiesGrid = Array(game.config.yDim).fill(null).map(() => Array(game.config.xDim).fill(null).map(() => new Map()));
|
||||||
|
@ -34,6 +34,13 @@ game.sprites = {
|
|||||||
numFrames: 3,
|
numFrames: 3,
|
||||||
timePerFrame: 100,
|
timePerFrame: 100,
|
||||||
}),
|
}),
|
||||||
|
lava: game.graphics.Sprite({
|
||||||
|
image: game.assets.lava,
|
||||||
|
spriteHeight: 24,
|
||||||
|
spriteWidth: 24,
|
||||||
|
numFrames: 3,
|
||||||
|
timePerFrame: 100,
|
||||||
|
}),
|
||||||
rock: game.graphics.Sprite({
|
rock: game.graphics.Sprite({
|
||||||
image: game.assets.rock,
|
image: game.assets.rock,
|
||||||
spriteHeight: 24,
|
spriteHeight: 24,
|
||||||
@ -48,6 +55,13 @@ game.sprites = {
|
|||||||
numFrames: 3,
|
numFrames: 3,
|
||||||
timePerFrame: 100,
|
timePerFrame: 100,
|
||||||
}),
|
}),
|
||||||
|
water: game.graphics.Sprite({
|
||||||
|
image: game.assets.water,
|
||||||
|
spriteHeight: 24,
|
||||||
|
spriteWidth: 24,
|
||||||
|
numFrames: 3,
|
||||||
|
timePerFrame: 100,
|
||||||
|
}),
|
||||||
wordBigBlue: game.graphics.Sprite({
|
wordBigBlue: game.graphics.Sprite({
|
||||||
image: game.assets.wordBigBlue,
|
image: game.assets.wordBigBlue,
|
||||||
spriteHeight: 24,
|
spriteHeight: 24,
|
||||||
|
@ -19,12 +19,33 @@ game.loadLevel = (level) => {
|
|||||||
case 'f':
|
case 'f':
|
||||||
entity = game.createFlag();
|
entity = game.createFlag();
|
||||||
break;
|
break;
|
||||||
|
case 'g':
|
||||||
|
entity = game.createGrass();
|
||||||
|
break;
|
||||||
case 'l':
|
case 'l':
|
||||||
entity = game.createFloor();
|
entity = game.createFloor();
|
||||||
break;
|
break;
|
||||||
case 'w':
|
case 'w':
|
||||||
entity = game.createWall();
|
entity = game.createWall();
|
||||||
break;
|
break;
|
||||||
|
case 'a':
|
||||||
|
entity = game.createWater();
|
||||||
|
break;
|
||||||
|
case 'A':
|
||||||
|
entity = game.createWordWater();
|
||||||
|
break;
|
||||||
|
case 'N':
|
||||||
|
entity = game.createWordSink();
|
||||||
|
break;
|
||||||
|
case 'V':
|
||||||
|
entity = game.createWordLava();
|
||||||
|
break;
|
||||||
|
case 'v':
|
||||||
|
entity = game.createLava();
|
||||||
|
break;
|
||||||
|
case 'K':
|
||||||
|
entity = game.createWordKill();
|
||||||
|
break;
|
||||||
case 'W':
|
case 'W':
|
||||||
entity = game.createWordWall();
|
entity = game.createWordWall();
|
||||||
break;
|
break;
|
||||||
|
Loading…
Reference in New Issue
Block a user