summaryrefslogtreecommitdiff
path: root/src/game.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/game.js')
-rw-r--r--src/game.js19
1 files changed, 12 insertions, 7 deletions
diff --git a/src/game.js b/src/game.js
index 4efceae..c1b9c05 100644
--- a/src/game.js
+++ b/src/game.js
@@ -1,10 +1,15 @@
-const context = document.getElementById('game-canvas').getContext('2d');
-context.imageSmoothingEnabled = false;
+game.loop = (elapsedTime) => {
+ game.systems.Render.update(elapsedTime);
-console.log("HELLO")
-game.initialize = () => {
- context.clearRect(0, 0, game.width, game.height);
- context.drawImage(game.assets.bigblue, 0, 0, game.width, game.height);
+ requestAnimationFrame(game.loop);
+}
- console.log("BITCH")
+game.initialize = () => {
+ game.entities = {};
+ game.bigBlue = game.createBigBlue();
+ game.entities[game.bigBlue.id] = game.bigBlue;
+ game.bigBlue2 = game.createBigBlue();
+ game.bigBlue2.components.position = game.components.Position({x: 200, y: 100});
+ game.entities[game.bigBlue2.id] = game.bigBlue2;
+ requestAnimationFrame(game.loop);
}