184 : Add key status

Balthazar:

Load an image of the key that we can use in the status area.

function init_game() { ... _game.meter_width = 150; _game.meter_height = 20; // Status images _game.img_key = new Image(); _game.img_key.src = _game.imagedir_items + "key.png"; }
function draw_status(ctx) { var health = (_game.meter_width * _player.health) / _player.health_max; ctx.fillStyle = "rgba(0,255,0, 0.5)"; ctx.fillRect(_game.meter_x, _game.meter_y, health, _game.meter_height); ctx.strokeStyle = "black"; ctx.strokeRect(_game.meter_x, _game.meter_y, _game.meter_width, _game.meter_height); // If the player has the key, draw it in the status area. var level = _levels[_game.current_level]; if (level.player_has_key) { ctx.drawImage(_game.img_key, _game.meter_width + 15, 11); } }

GOTO 192 if you already have the Vitality II - Reincarnation badge.

GOTO 134 if you NOT have the Treasure I - Key badge.

GOTO 100