update bootstrap, fix flag.js filename, add rock

This commit is contained in:
phat_sumo 2022-04-01 17:49:20 -06:00
parent d5750294b1
commit 4d34b0b4b8
3 changed files with 41 additions and 3 deletions

26
src/bootstrap.js vendored
View File

@ -2,8 +2,28 @@ game.bootstrap = (() => {
const scripts = [ const scripts = [
{ src: ['src/render/graphics.js'], id: 'render' }, { src: ['src/render/graphics.js'], id: 'render' },
{ src: ['src/components/component.js', 'src/components/position.js', 'src/components/appearence.js'], id: 'components' }, { src: ['src/components/component.js', 'src/components/position.js', 'src/components/appearence.js'], id: 'components' },
{ src: ['src/entities/entity.js'], id: 'entity' }, { src: ['src/entities/entity.js'], id: 'entity' },
{ src: ['src/entities/bigblue.js'], id: 'entities' }, { src: ['src/entities/bigblue.js'], id: 'entities' },
{ src: ['src/entities/flag.js'], id: 'entities' },
{ src: ['src/entities/floor.js'], id: 'entities' },
{ src: ['src/entities/grass.js'], id: 'entities' },
{ src: ['src/entities/hedge.js'], id: 'entities' },
{ src: ['src/entities/liquid.js'], id: 'entities' },
{ src: ['src/entities/rock.js'], id: 'entities' },
{ src: ['src/entities/wall.js'], id: 'entities' },
{ src: ['src/entities/wordBigBlue.js'], id: 'entities' },
{ src: ['src/entities/wordFlag.js'], id: 'entities' },
{ src: ['src/entities/wordIs.js'], id: 'entities' },
{ src: ['src/entities/wordKill.js'], id: 'entities' },
{ src: ['src/entities/wordLava.js'], id: 'entities' },
{ src: ['src/entities/wordPush.js'], id: 'entities' },
{ src: ['src/entities/wordRock.js'], id: 'entities' },
{ src: ['src/entities/wordSink.js'], id: 'entities' },
{ src: ['src/entities/wordStop.js'], id: 'entities' },
{ src: ['src/entities/wordWall.js'], id: 'entities' },
{ src: ['src/entities/wordWater.js'], id: 'entities' },
{ src: ['src/entities/wordWin.js'], id: 'entities' },
{ src: ['src/entities/wordYou.js'], id: 'entities' },
{ src: ['src/systems/render.js'], id: 'systems' }, { src: ['src/systems/render.js'], id: 'systems' },
{ src: ['src/game.js'], id: 'game' }, { src: ['src/game.js'], id: 'game' },
]; ];
@ -64,4 +84,4 @@ game.bootstrap = (() => {
loadAssets().then(() => { loadAssets().then(() => {
loadScripts(() => game.initialize()); loadScripts(() => game.initialize());
}) })
})(); })();

13
src/entities/flag.js Normal file
View File

@ -0,0 +1,13 @@
game.createFlag = () => {
const flag = game.Entity();
flag.addComponent(game.components.Position({x: 0, y: 0}));
flag.addComponent(game.components.Appearance({rot: 0, width: 100, height: 100}));
flag.sprite = game.graphics.Sprite({
image: game.assets.flag,
spriteHeight: 24,
spriteWidth: 24,
numFrames: 3,
timePerFrame: 100,
});
return flag;
}

View File

@ -11,5 +11,10 @@ game.initialize = () => {
game.bigBlue2 = game.createBigBlue(); game.bigBlue2 = game.createBigBlue();
game.bigBlue2.components.position = game.components.Position({x: 200, y: 100}); game.bigBlue2.components.position = game.components.Position({x: 200, y: 100});
game.entities[game.bigBlue2.id] = game.bigBlue2; game.entities[game.bigBlue2.id] = game.bigBlue2;
game.rock = game.createRock();
game.rock.components.position = game.components.Position({x: 200, y: 200});
game.entities[game.rock.id] = game.rock;
requestAnimationFrame(game.loop); requestAnimationFrame(game.loop);
} }