Skip to content

Commit

Permalink
multiple city interactions are added (#77)
Browse files Browse the repository at this point in the history
Relates to #29
  • Loading branch information
r4pt0s authored Oct 3, 2024
2 parents fc116d0 + 3d43242 commit 5b516eb
Show file tree
Hide file tree
Showing 5 changed files with 164 additions and 0 deletions.
19 changes: 19 additions & 0 deletions src/interactions/map_city/boundaryArcade.interaction.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import { displayPermissionBox } from '../../utils';

export const boundaryArcadeInteraction = (player, k) => {
player.onCollide('boundary_arcade', async () => {

let wantToPlay = await displayPermissionBox(
'Hello! Would you like to play some arcade games?'
);


if (wantToPlay) {
import('../../scenes/arcade').then((_) => {
k.go('arcade');
});
} else {
k.debug.log('Maybe next time!');
}
});
};
17 changes: 17 additions & 0 deletions src/interactions/map_city/boundaryBurgerBar.interaction.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import { displayPermissionBox } from '../../utils';

export const boundaryBurgerBarInteraction = (player, k) => {
player.onCollide('boundary_burger_bar', async () => {

let wantBurger = await displayPermissionBox(
'Hello! Would you like a burger?'
);


if (wantBurger) {
k.debug.log('Enjoy your burger!'); //testing purposes you may uncomment it or add displayPermission box your wish
} else {
k.debug.log('Maybe next time!');
}
});
};
12 changes: 12 additions & 0 deletions src/interactions/map_city/index.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,21 @@
import { boundaryArcadeInteraction } from './boundaryArcade.interaction';
import { boundaryBurgerBarInteraction } from './boundaryBurgerBar.interaction';
import { enterMapArcadeInteraction } from './enterMapArcade.interactions';
import { enterMapStartInteraction } from './enterMapStart.interaction';
import { snackBarRedInteraction , snackBarGreenInteraction, snackBarStreetInteraction } from './snackBars.interactions';
import { stall1Interaction, stall2Interaction } from './stalls.interaction';


const interactions = [
enterMapArcadeInteraction,
enterMapStartInteraction,
boundaryBurgerBarInteraction,
boundaryArcadeInteraction,
snackBarRedInteraction,
snackBarGreenInteraction,
snackBarStreetInteraction,
stall1Interaction,
stall2Interaction
// Add more interactions here
];

Expand Down
70 changes: 70 additions & 0 deletions src/interactions/map_city/snackBars.interactions.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
import { displayPermissionBox } from '../../utils';


export const snackBarGreenInteraction = (player, k) => {
player.onCollide('snack_bar_green', async () => {
let ztmSnackDecision = await displayPermissionBox(
'Welcome to Snack Bar Green! Ready to go from zero to snack mastery?'
);

if (ztmSnackDecision) {
k.debug.log('Congratulations! You’ve mastered the art of snacking, ZTM style!');
} else {
let secondSnackChance = await displayPermissionBox(
'Are you sure? The path to snack mastery is only one bite away...'
);

if (secondSnackChance) {
k.debug.log('Great choice! You’re on your way to becoming a Snack Sensei!');
} else {
k.debug.log('Looks like you missed the Snack Mastery Bootcamp. Better luck next time!');
}
}
});
};


export const snackBarRedInteraction = (player, k) => {
player.onCollide('snack_bar_red', async () => {
let snackOffer = await displayPermissionBox(
'Welcome to Snack Bar Red! The *real* masters of snacking... Unlike *ahem* some green wannabes across the street. Ready for the best snack experience?'
);

if (snackOffer) {
k.debug.log('Excellent choice! You clearly have superior taste. Snack Bar Green can’t compete!');
} else {
let changeMind = await displayPermissionBox(
'Are you sure? Don’t tell me you’re thinking of going to *that* green place... Their snacks are... well, let’s just say "unimpressive."'
);

if (changeMind) {
k.debug.log('Wise move! Snack Bar Red – where the real snack mastery happens!');
} else {
k.debug.log('Suit yourself! But don’t say I didn’t warn you... Snack Bar Green’s snacks are basically "Zero to Mediocrity."');
}
}
});
};


export const snackBarStreetInteraction = (player, k) => {
player.onCollide('snack_bar_street', async () => {
let snackDecision = await displayPermissionBox(
'Psst! You look hungry! How about a snack? It’s a secret recipe!'
);

if (snackDecision) {
k.debug.log('Yum! You just ate the best mystery snack of your life!');
} else {
let secondChance = await displayPermissionBox(
'Are you sure? It’s low calorie and totally NOT haunted! Still no?'
);

if (secondChance) {
k.debug.log('Ah, there we go! Enjoy your... totally normal snack.');
} else {
k.debug.log('Your loss! The snack of the century is only a bite away...');
}
}
});
};
46 changes: 46 additions & 0 deletions src/interactions/map_city/stalls.interaction.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
import { displayPermissionBox } from '../../utils';


export const stall1Interaction = (player, k) => {
player.onCollide('stall_1', async () => {
let stall1Offer = await displayPermissionBox(
'🎉 Welcome to Stall 1! Our secret ingredient is... a sprinkle of **joy**! Ready to snack like a champ?'
);

if (stall1Offer) {
k.debug.log('🚀 Awesome choice! Here’s your snack – made with love and just a hint of magic!');
} else {
let secondChance = await displayPermissionBox(
'🤔 Are you absolutely sure? Our snacks are scientifically proven to elevate your happiness levels! Or do you prefer sadness-flavored snacks?'
);

if (secondChance) {
k.debug.log('😋 Yass! You’re now part of the snack elite! Enjoy your crispy delight!');
} else {
k.debug.log('😢 Your loss! But hey, who am I to judge? Just remember, you’re missing out on epic flavor adventures!');
}
}
});
};

export const stall2Interaction = (player, k) => {
player.onCollide('stall_2', async () => {
let stall2Offer = await displayPermissionBox(
'🎊 Ahoy! Welcome to Stall 2! We don’t just sell snacks; we sell **memories**! Care to join the flavor revolution?'
);

if (stall2Offer) {
k.debug.log('🌈 Fantastic! Here’s a snack that might just change your life! Or at least your lunch!');
} else {
let secondThoughts = await displayPermissionBox(
'🚫 Wait a minute! Are you really about to miss the chance to munch on greatness? Don’t you want to be a snack legend?'
);

if (secondThoughts) {
k.debug.log('🌟 You’ve made the right call! Enjoy the epic flavors of Stall 2! Snack on, my friend!');
} else {
k.debug.log('🤷‍♂️ Suit yourself! But don’t come crying to me when you realize Stall 1’s snacks are just plain!');
}
}
});
};

0 comments on commit 5b516eb

Please sign in to comment.