Skip to content

Commit

Permalink
Merge pull request #28 from TheWilley/contribute
Browse files Browse the repository at this point in the history
added ability to add images to characters
  • Loading branch information
okaybenji authored Aug 14, 2023
2 parents 5600718 + eb24970 commit 53111d6
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 0 deletions.
19 changes: 19 additions & 0 deletions game-disks/demo-disk.js
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,25 @@ const demoDisk = () => ({
name: ['Benji', 'Benj', 'receptionist'],
roomId: 'reception',
desc: 'He looks... helpful!', // printed when the player looks at the character
img: `
.------\\ /------.
| - |
| |
| |
| |
_______________________
===========.===========
/ ~~~~~ ~~~~~ \\
/| | |\\
W --- / \\ --- W
\\. |o o| ./
| |
\\ ######### /
\\ ## ----- ## /
\\## ##/
\\_____v_____/
`,
// optional callback, run when the player talks to this character
onTalk: () => println(`"Hi," he says, "How can I help you?"`),
// things the player can discuss with the character
Expand Down
6 changes: 6 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -243,13 +243,19 @@ let lookAt = (args) => {
} else {
const character = getCharacter(name, getCharactersInRoom(disk.roomId));
if (character) {
// show character image if available
if(character.img) {
println(character.img, 'img');
}

// Look at a character.
if (character.desc) {
println(character.desc);
} else {
println(`You don't notice anything remarkable about them.`);
}


if (typeof(character.onLook) === 'function') {
character.onLook({disk, println, getRoom, enterRoom, item});
}
Expand Down

0 comments on commit 53111d6

Please sign in to comment.