add oxygen meter
This commit is contained in:
+15
-3
@@ -83,12 +83,16 @@ function toggleDevInfos() {
|
||||
}
|
||||
}
|
||||
|
||||
// * HUD Renderfunktion
|
||||
function renderHudSprites() {
|
||||
const hudObject = {
|
||||
player_hitpoints: player.currentHitpoints,
|
||||
player_collected: player.collected,
|
||||
player_hitpoints: globalObject.hitpoints,
|
||||
player_collected: globalObject.collected,
|
||||
player_lifes: globalObject.lifes,
|
||||
player_ammo: globalObject.ammo,
|
||||
player_swimming: player.swimming,
|
||||
player_diving: player.diving,
|
||||
player_oxygen: Math.trunc(globalObject.oxygen),
|
||||
}
|
||||
|
||||
function hitpoints() {
|
||||
@@ -98,8 +102,16 @@ function renderHudSprites() {
|
||||
ctx.font = '12px C64 TrueType'
|
||||
|
||||
ctx.fillStyle = 'white'
|
||||
ctx.fillText(`lifes: ${hudObject.player_lifes}`, 50, 50)
|
||||
// Hitpoints
|
||||
ctx.fillText(`HP: ${hudObject.player_hitpoints}`, 20, 40)
|
||||
// Extralifes
|
||||
ctx.fillText(`lifes: ${hudObject.player_lifes}`, 20, 20)
|
||||
// Ammo
|
||||
ctx.fillText(`ammo: ${hudObject.player_ammo}`, 200, 50)
|
||||
|
||||
// Oxygen
|
||||
ctx.fillText(`O2: ${hudObject.player_oxygen}`, 200, 20)
|
||||
|
||||
ctx.restore()
|
||||
}
|
||||
hitpoints()
|
||||
|
||||
Reference in New Issue
Block a user