Skip to content

Commit

Permalink
add dummy mailbox interaction (#40)
Browse files Browse the repository at this point in the history
  • Loading branch information
r4pt0s authored Oct 1, 2024
2 parents 6bcb51e + 4bce7e0 commit 5d71eff
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/interactions/map_start/index.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
import { interactionWithBruno } from './bruno.interaction';
import { enterMapCityInteraction } from './enterMapCity.interaction';
import { interactionWithMainboxMainArea } from './mailboxMainArea.interaction';
import { restroomInteractions } from './restroom.interactions';

const interactions = [
restroomInteractions,
interactionWithBruno,
enterMapCityInteraction,
interactionWithMainboxMainArea,
// Add more interactions here
];

Expand Down
24 changes: 24 additions & 0 deletions src/interactions/map_start/mailboxMainArea.interaction.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import { displayDialogue } from '../../utils';

export const getDummyText = () => {
// 0 to 10 (inclusive)
const num = Math.floor(Math.random() * 11);
if (num > 1) {
return `You have ${num} messages in your mailbox`;
}
if (num === 1) {
return `You have ${num} message in your mailbox`;
}
if (num === 0) {
return `You have no messages in your mailbox`;
}
};

export const interactionWithMainboxMainArea = (player, k, map) => {
player.onCollide('mailbox_mainArea', () => {
player.isInDialog = true;
displayDialogue(getDummyText(), () => {
player.isInDialog = false;
});
});
};

0 comments on commit 5d71eff

Please sign in to comment.