Skip to content

Commit

Permalink
Add flashlihjt.
Browse files Browse the repository at this point in the history
  • Loading branch information
oskarwrobel committed Dec 3, 2023
1 parent b81d4dc commit 9ad9587
Show file tree
Hide file tree
Showing 5 changed files with 71 additions and 5 deletions.
2 changes: 1 addition & 1 deletion public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Abandoned house game</title>
<title>Abandoned House Game</title>

<meta name="keywords" content="game, svg, html, javascript">
<meta name="description" content="PoC of svg based game.">
Expand Down
34 changes: 34 additions & 0 deletions src/game/assets/images/flashlight-big.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 2 additions & 0 deletions src/game/assets/images/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import hallRightDoorOpen from "./hall-right-door-open.svg?url";
import key from "./key.svg?url";
import backButton from "./back-button.svg?url";
import flashlight from "./flashlight.svg?url";
import flashlightBig from "./flashlight-big.svg?url";

import digit0 from "./digit0.svg?url";
import digit1 from "./digit1.svg?url";
Expand Down Expand Up @@ -41,6 +42,7 @@ export default {
key,
backButton,
flashlight,
flashlightBig,

digit0,
digit1,
Expand Down
34 changes: 34 additions & 0 deletions src/game/scenes/room-basement/RoomBasementCloset.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import Scene from "../../../game-engine/scenes/Scene";
import Flashlight from "../../items/Flashlight";

export default class RoomBasementCloset extends Scene {
/**
Expand Down Expand Up @@ -44,6 +45,39 @@ export default class RoomBasementCloset extends Scene {
},
});

scene.createItem({
id: "flashlight-big",
attributes: {
classes: ["clickable"],
image: "flashlightBig",
},
coords: {
top: 570,
left: 640,
shape: [
[20, 0],
[78, 12],
[87, 27],
[276, 44],
[287, 56],
[283, 93],
[270, 100],
[81, 82],
[70, 95],
[10, 96],
[0, 47],
],
},
events: {
click: () => {
game.sounds.play("button");
scene.removeItem("flashlight-big");
Flashlight.create(game);
game.equipment.addItem("flashlight");
},
},
});

scene.addBackButton("room-basement");

return game.scenes.add(scene);
Expand Down
4 changes: 0 additions & 4 deletions src/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,6 @@ Promise.all([game.sounds.preload(), game.images.preload()]).then(() => {
// Set initial scene.
game.scenes.show("hall");

// Adds flashlight to the storage (just to test it).
Flashlight.create(game);
game.equipment.addItem("flashlight");

// Adjust game size each time screen properties have changed.
window.addEventListener("resize", () => game.update());
window.addEventListener("orientationchange", () => game.update());
Expand Down

0 comments on commit 9ad9587

Please sign in to comment.