Commit to Deno project.

This commit is contained in:
2021-04-28 16:55:22 -07:00
parent 2b1f9ffba1
commit c1935e58be
12 changed files with 104 additions and 43 deletions

22
Scene.ts Normal file
View File

@ -0,0 +1,22 @@
import { GameData, Item } from "./data/data.ts";
export default class Scene {
#items: Item[];
constructor(gameData: GameData) {
this.#items = gameData.items;
}
take(target: string): Item | null {
const idx = this.#items.findIndex(({ name }) => name === target);
if (idx >= 0) {
const item = this.#items[idx];
this.#items = this.#items.splice(idx, 1);
return item;
}
return null;
}
}