summaryrefslogtreecommitdiff
path: root/src/game.js
diff options
context:
space:
mode:
authorLogan Hunt <loganhunt@simponic.xyz>2022-04-01 17:12:37 -0600
committerLogan Hunt <loganhunt@simponic.xyz>2022-04-01 17:12:37 -0600
commit100bbecccbf7b5e09ee60d1c2934df09006344f1 (patch)
tree08d9fbc488b5b33066fac14bad1c02e72ecb0a2d /src/game.js
parent4cabba2561f55ee6d068d631e3272ff7bf984b37 (diff)
downloadbbiy-100bbecccbf7b5e09ee60d1c2934df09006344f1.tar.gz
bbiy-100bbecccbf7b5e09ee60d1c2934df09006344f1.zip
Fix sprites
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);
}