Skip to content

Commit

Permalink
Add landmine to renderer
Browse files Browse the repository at this point in the history
  • Loading branch information
delasy committed Oct 27, 2024
1 parent fc6f33f commit 21f6695
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 1 deletion.
14 changes: 14 additions & 0 deletions public/entities/landmine.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 5 additions & 1 deletion renderer/Assets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ export interface RendererAssets {
loaded: boolean;
bg: HTMLImageElement | null;
box: HTMLImageElement | null;
landmine: HTMLImageElement | null;
player: HTMLImageElement | null;
rock: HTMLImageElement | null;
zombie: HTMLImageElement | null;
Expand All @@ -15,6 +16,7 @@ export const assets: RendererAssets = {
loaded: false,
bg: null,
box: null,
landmine: null,
player: null,
rock: null,
zombie: null,
Expand All @@ -29,10 +31,11 @@ export async function loadAssets() {

assets.loading = true;

const [bg, box, player, rock, zombie, zombieDead, zombieWalking] =
const [bg, box, landmine, player, rock, zombie, zombieDead, zombieWalking] =
await Promise.all([
loadAssetImage("/map.webp"),
loadAssetImage("/entities/box.svg"),
loadAssetImage("/entities/landmine.svg"),
loadAssetImage("/entities/player-attacking.svg"),
loadAssetImage("/entities/rock.svg"),
loadAssetImage("/entities/zombie-idle.svg"),
Expand All @@ -43,6 +46,7 @@ export async function loadAssets() {
assets.loaded = true;
assets.bg = bg;
assets.box = box;
assets.landmine = landmine;
assets.player = player;
assets.rock = rock;
assets.zombie = zombie;
Expand Down
3 changes: 3 additions & 0 deletions renderer/Renderer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,9 @@ export class Renderer {
case EntityType.Box: {
return assets.box;
}
case EntityType.Landmine: {
return assets.landmine;
}
case EntityType.Player: {
return assets.player;
}
Expand Down

0 comments on commit 21f6695

Please sign in to comment.