add vehicle test

This commit is contained in:
StrangeD0s
2023-02-19 01:05:41 +01:00
parent 4ec4e0ad24
commit c11dcf9076
7 changed files with 84 additions and 0 deletions
+20
View File
@@ -26,6 +26,7 @@ function render(ctx, frame, dt, thiscurrentLevel) {
renderMonsters(ctx, enemyAtlas, dt, frame)
renderTreasure(ctx, itemsAtlas, dt, frame)
renderPickups(ctx, itemsAtlas, dt, frame)
renderVehicless(ctx, enemyAtlas, dt, frame)
renderForeground(ctx, thiscurrentLevel.foregroundAtlas, fgCells)
renderLiquids(ctx, thiscurrentLevel.foregroundAtlas, fgCells)
@@ -202,6 +203,25 @@ function renderPlayer(ctx, spriteAtlas, dt, frame) {
ctx.globalAlpha = 1
}
function renderVehicless(ctx, spriteAtlas, dt, frame) {
ctx.fillStyle = COLOR.BRICK
var n, max, vehicle
for (n = 0, max = vehicles.length; n < max; n++) {
vehicle = vehicles[n]
if (vehicle.sprites === undefined && !vehicle.dead)
ctx.fillRect(
vehicle.x + vehicle.dx * dt,
vehicle.y + vehicle.dy * dt,
32,
32
)
if (vehicle.sprites !== undefined && !vehicle.dead) {
//drawSprite(vehicle, spriteAtlas, dt, frame)
}
}
}
function renderHud(ctx, spriteAtlas, dt, frame) {
var n, max
const hudScaling = scalingFactor / 2