Adventures in
JavaScript
065 : Finish monster init
function draw_platforms(ctx) {
...
}
function draw_monsters(ctx) {
var monsters = _game.monsters;
for (var i = 0; i < monsters.length; i++) {
var m = monsters[i];
ctx.fillStyle = "#800000";
ctx.fillRect(m.x - m.origin_x, m.y - m.origin_y, m.width, m.height);
}
}
function draw_goal(ctx) {
...
}
Balthazar:
in the draw() function:
function draw() {
...
erase(ctx);
draw_platforms(ctx);
draw_goal(ctx);
draw_monsters(ctx);
draw_player(ctx);
...
}
GOTO 056