Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/interactions/map_city/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import { enterMapSeasideInteraction } from './enterMapSeasideInteraction.interac
import { enterMapExtendedCampus } from './enterMapExtendedCampus.interactions';
import { enterMapExtendedCampusTop } from './enterMapExtendCampusTop.interactions';
import { interactionWithBin } from './bin.interaction';
import {interactionWithSoccerBall} from './soccerBall.interaction'

const interactions = [
enterMapArcadeInteraction,
Expand All @@ -36,6 +37,7 @@ const interactions = [
// Add more interactions here
enterMapCampusHouse1Interaction,
interactionWithBin,
interactionWithSoccerBall
];

export default interactions;
29 changes: 29 additions & 0 deletions src/interactions/map_city/soccerBall.interaction.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import { displayDialogue } from '../../utils';

const getRandomMessage = (min, max) => {
return Math.floor(Math.random() * (max - min + 1)) + min;
};

const messages = [
["Hey! Watch where you're kicking!"],
["Goal vibes only!"],
["You think you can bend it like Beckham?"],
["Ouch! That tickled!"],
["Keep me rolling, champ!"],
["I'm ready for the World Cup!"],
["Nice touch! Want to try a trick shot?"],
["You’ve got good footwork!"],
["Don't leave me sitting here, let's play! 🏃‍♂️💨"]
];

export const interactionWithSoccerBall = (player, k, map) => {
player.onCollide('soccerBall', () => {
const randomMessage = getRandomMessage(0, messages.length - 1);

displayDialogue({
k,
player,
text: messages[randomMessage],
});
});
};