This commit is contained in:
biglyderv 2024-11-25 14:14:20 -05:00
parent 7fbe113061
commit 8278445e88
4 changed files with 140 additions and 2 deletions

View file

@ -5,6 +5,7 @@ const cs = 1024;
const assets = [
'assets/player.svg',
'assets/head.svg',
'assets/map.svg'
];
class Game extends GameBasic {
@ -27,7 +28,7 @@ class Game extends GameBasic {
this.assetsIn = assetsIn;
}
render() {
let { ctx, assetsIn, entities, player } = this;
let { ctx, assetsIn, entities, player, width, height } = this;
ctx.clearRect(0, 0, cs, cs);
@ -35,6 +36,8 @@ class Game extends GameBasic {
ctx.translate(player.camera.x + cs / 2, player.camera.y + cs / 2);
ctx.drawImage(assetsIn[2],-width/2,-height/2,width,height);
for (let ent of entities) {
if (ent.health <= 0) continue;