add enemy

This commit is contained in:
biglyderv 2024-11-25 14:14:21 -05:00
parent 276e11fb49
commit edd005cb4d
7 changed files with 137 additions and 10 deletions

View file

@ -1,18 +1,28 @@
import Player from "./player.js";
import GameBasic from "./game_basic.js";
import NPC from "./npc.js";
import Shooter from "./shooter.js";
const cs = 1024;
const assets = [
'assets/player.svg',
'assets/head.svg',
'assets/map.svg',
'assets/npc.svg'
'assets/npc.svg',
'assets/shooter.svg'
];
const legalTypes = {
Player,
NPC
NPC,
Shooter
}
const bodies = {
'Player': 0,
'NPC': 3,
'Shooter': 4
};
const emojis = [
'Troll',
'Exit',
@ -79,7 +89,8 @@ class Game extends GameBasic {
ctx.fill();
}
ctx.drawImage((ent.type == 'NPC') ? assetsIn[3] : assetsIn[0], ent.pos.x - 64 / 2, ent.pos.y - 64 / 2, 64, 64);
let a = assetsIn[bodies[ent.type]]
ctx.drawImage(a, ent.pos.x - 64 / 2, ent.pos.y - 64 / 2, 64, 64);
if (ent.type != 'Player') continue;