From 6ff05b02f32ee4735505ddaebd9ecbf4d164077e Mon Sep 17 00:00:00 2001 From: Miro Date: Tue, 1 Oct 2024 10:52:34 -0700 Subject: [PATCH 1/6] Adding game's store logic in JS --- .../enterStoreMainArea.interaction.js | 23 +++++++++++++++++++ src/interactions/map_start/index.js | 1 + 2 files changed, 24 insertions(+) create mode 100644 src/interactions/map_start/enterStoreMainArea.interaction.js diff --git a/src/interactions/map_start/enterStoreMainArea.interaction.js b/src/interactions/map_start/enterStoreMainArea.interaction.js new file mode 100644 index 00000000..007e1fa1 --- /dev/null +++ b/src/interactions/map_start/enterStoreMainArea.interaction.js @@ -0,0 +1,23 @@ +import { displayDialogue } from '../../utils'; + +//player interaction logic with store +export const sampleStoreInteraction = () => { + // sample of coins balance + var coinBal = 1000; + + return 'You have ${coinBal} coins to spend'; + +}; + +//shows what happens when player is in store +export const storeMainAreaInteraction = (player, k, map) => { + //if user runs into the store, show them the balance + player.onCollide('store_mainArea', () => { + player.isInDialog = true; + displayDialogue(sampleStoreInteraction(), () => { + player.isInDialog = false; + }); + + + }); +}; \ No newline at end of file diff --git a/src/interactions/map_start/index.js b/src/interactions/map_start/index.js index 066aaec1..72021a71 100644 --- a/src/interactions/map_start/index.js +++ b/src/interactions/map_start/index.js @@ -9,6 +9,7 @@ const interactions = [ enterMapCityInteraction, interactionWithMainboxMainArea, // Add more interactions here + interactionWithStoreMainArea, ]; export const attachInteractions = (gameObj, k) => { From 838e525f79c48607bb0458d388cd9e2b4231d28e Mon Sep 17 00:00:00 2001 From: Miro Date: Tue, 1 Oct 2024 13:24:21 -0700 Subject: [PATCH 2/6] Updated with map_city interactions moved out from map_start --- src/interactions/map_arcade/index.js | 3 ++ .../map_city/enterMapArcade.interactions.js | 24 +++++++++++--- .../enterStoreMainArea.interaction.js | 31 +++++++++++++++++++ src/interactions/map_start/index.js | 2 +- 4 files changed, 55 insertions(+), 5 deletions(-) create mode 100644 src/interactions/map_city/enterStoreMainArea.interaction.js diff --git a/src/interactions/map_arcade/index.js b/src/interactions/map_arcade/index.js index f958d30c..e98276c1 100644 --- a/src/interactions/map_arcade/index.js +++ b/src/interactions/map_arcade/index.js @@ -1,8 +1,11 @@ +import { storeMainAreaInteraction } from '../map_city/enterStoreMainArea.interaction'; import { enterMapCityInteraction } from './enterMapCity.interactions'; const interactions = [ enterMapCityInteraction, // Add more interactions here + storeMainAreaInteraction, + interactionWithArcadeArea ]; export const attachInteractions = (gameObj, k) => { diff --git a/src/interactions/map_city/enterMapArcade.interactions.js b/src/interactions/map_city/enterMapArcade.interactions.js index 157dbdb7..2a74dd79 100644 --- a/src/interactions/map_city/enterMapArcade.interactions.js +++ b/src/interactions/map_city/enterMapArcade.interactions.js @@ -1,7 +1,23 @@ -export const enterMapArcadeInteraction = (player, k) => { +import { displayDialogue } from '../../utils'; + +//player interaction logic with arcade +export const sampleArcadeInteraction = () => { + // sample of coins balance + var coinBal = 1000; + + return 'You have ${coinBal} coins to spend'; + +}; + +//shows what happens when player is in arcade +export const storeMainAreaInteraction = (player, k, map) => { + //if user runs into the store (arcade in this example), show them the balance player.onCollide('enter_map_arcade', () => { - import('../../scenes/arcade').then((_) => { - k.go('arcade'); + player.isInDialog = true; + displayDialogue(sampleArcadeInteraction(), () => { + player.isInDialog = false; }); + + }); -}; +}; \ No newline at end of file diff --git a/src/interactions/map_city/enterStoreMainArea.interaction.js b/src/interactions/map_city/enterStoreMainArea.interaction.js new file mode 100644 index 00000000..b8223130 --- /dev/null +++ b/src/interactions/map_city/enterStoreMainArea.interaction.js @@ -0,0 +1,31 @@ +import { displayDialogue } from '../../utils'; +import { sampleStoreInteraction, sampleArcadeInteraction } from './enterMapArcade.interactions'; + +//player interaction logic with arcade +function sampleArcadeInteraction() { + // sample of coins balance + var coinBal = 1000; + + return 'You have ${coinBal} coins to spend'; + +}; + +//shows what happens when player is in arcade +export const storeMainAreaInteraction = (player, k, map) => { + //if user runs into the arcade, show them the balance + player.onCollide('enter_map_arcade', () => { + player.isInDialog = true; + displayDialogue(sampleStoreInteraction(), () => { + player.isInDialog = false; + }); + //if user runs into the house, show them the house + player.onCollide('tiny_house_top_left_door', () => { + player.isInDialog = true; + /*displayDialogue(sampleTinyHouseInteraction(), () => { //sampleTinyHouseInteraction needs building + player.isInDialog = false; + });*/ + }); + + + }); +}; \ No newline at end of file diff --git a/src/interactions/map_start/index.js b/src/interactions/map_start/index.js index 72021a71..e1b4e29c 100644 --- a/src/interactions/map_start/index.js +++ b/src/interactions/map_start/index.js @@ -2,6 +2,7 @@ import { interactionWithBruno } from './bruno.interaction'; import { enterMapCityInteraction } from './enterMapCity.interaction'; import { interactionWithMainboxMainArea } from './mailboxMainArea.interaction'; import { restroomInteractions } from './restroom.interactions'; +import { } from '../map_city/enterStoreMainArea.interaction'; const interactions = [ restroomInteractions, @@ -9,7 +10,6 @@ const interactions = [ enterMapCityInteraction, interactionWithMainboxMainArea, // Add more interactions here - interactionWithStoreMainArea, ]; export const attachInteractions = (gameObj, k) => { From 72f92552946ca3ca7ecbeb0cbe31d112911718f5 Mon Sep 17 00:00:00 2001 From: Miro Date: Thu, 3 Oct 2024 09:52:38 -0700 Subject: [PATCH 3/6] Resolving game store logic bugs --- src/gameObjects/map_arcade/index.js | 4 +++ .../map_city/enterMapArcade.interactions.js | 23 ---------------- .../enterStoreMainArea.interaction.js | 26 +++++++++++++------ .../enterStoreMainArea.interaction.js | 23 ---------------- src/interactions/map_start/index.js | 3 +++ 5 files changed, 25 insertions(+), 54 deletions(-) delete mode 100644 src/interactions/map_city/enterMapArcade.interactions.js delete mode 100644 src/interactions/map_start/enterStoreMainArea.interaction.js diff --git a/src/gameObjects/map_arcade/index.js b/src/gameObjects/map_arcade/index.js index c1666db4..1ec2abc3 100644 --- a/src/gameObjects/map_arcade/index.js +++ b/src/gameObjects/map_arcade/index.js @@ -1,5 +1,9 @@ +import { storeMainAreaInteraction } from '../map_city/enterStoreMainArea.interaction'; +import { enterMapCityInteraction } from './enterMapCity.interactions'; const gameObjects = [ // Add more game objects here + storeMainAreaInteraction, + interactionWithArcadeArea ]; export const addGameObjects = (k, map, spawnpoints) => { diff --git a/src/interactions/map_city/enterMapArcade.interactions.js b/src/interactions/map_city/enterMapArcade.interactions.js deleted file mode 100644 index 2a74dd79..00000000 --- a/src/interactions/map_city/enterMapArcade.interactions.js +++ /dev/null @@ -1,23 +0,0 @@ -import { displayDialogue } from '../../utils'; - -//player interaction logic with arcade -export const sampleArcadeInteraction = () => { - // sample of coins balance - var coinBal = 1000; - - return 'You have ${coinBal} coins to spend'; - -}; - -//shows what happens when player is in arcade -export const storeMainAreaInteraction = (player, k, map) => { - //if user runs into the store (arcade in this example), show them the balance - player.onCollide('enter_map_arcade', () => { - player.isInDialog = true; - displayDialogue(sampleArcadeInteraction(), () => { - player.isInDialog = false; - }); - - - }); -}; \ No newline at end of file diff --git a/src/interactions/map_city/enterStoreMainArea.interaction.js b/src/interactions/map_city/enterStoreMainArea.interaction.js index b8223130..a87ce9ea 100644 --- a/src/interactions/map_city/enterStoreMainArea.interaction.js +++ b/src/interactions/map_city/enterStoreMainArea.interaction.js @@ -10,6 +10,15 @@ function sampleArcadeInteraction() { }; +//player interaction logic with store +export const sampleStoreInteraction = () => { + // sample of coins balance + var coinBal = 1000; + + return 'You have ${coinBal} coins to spend'; + +}; + //shows what happens when player is in arcade export const storeMainAreaInteraction = (player, k, map) => { //if user runs into the arcade, show them the balance @@ -18,14 +27,15 @@ export const storeMainAreaInteraction = (player, k, map) => { displayDialogue(sampleStoreInteraction(), () => { player.isInDialog = false; }); - //if user runs into the house, show them the house - player.onCollide('tiny_house_top_left_door', () => { - player.isInDialog = true; - /*displayDialogue(sampleTinyHouseInteraction(), () => { //sampleTinyHouseInteraction needs building - player.isInDialog = false; - });*/ - }); }); -}; \ No newline at end of file +}; + +player.onCollide('tiny_house_top_left_door', () => { + player.isInDialog = true; + displayDialogue(sampleTinyHouseInteraction(), () => { //sampleTinyHouseInteraction needs building + player.isInDialog = false; + }); + +}); diff --git a/src/interactions/map_start/enterStoreMainArea.interaction.js b/src/interactions/map_start/enterStoreMainArea.interaction.js deleted file mode 100644 index 007e1fa1..00000000 --- a/src/interactions/map_start/enterStoreMainArea.interaction.js +++ /dev/null @@ -1,23 +0,0 @@ -import { displayDialogue } from '../../utils'; - -//player interaction logic with store -export const sampleStoreInteraction = () => { - // sample of coins balance - var coinBal = 1000; - - return 'You have ${coinBal} coins to spend'; - -}; - -//shows what happens when player is in store -export const storeMainAreaInteraction = (player, k, map) => { - //if user runs into the store, show them the balance - player.onCollide('store_mainArea', () => { - player.isInDialog = true; - displayDialogue(sampleStoreInteraction(), () => { - player.isInDialog = false; - }); - - - }); -}; \ No newline at end of file diff --git a/src/interactions/map_start/index.js b/src/interactions/map_start/index.js index 3af5dc9a..cc44c23b 100644 --- a/src/interactions/map_start/index.js +++ b/src/interactions/map_start/index.js @@ -2,6 +2,9 @@ import { interactionWithBruno } from './bruno.interaction'; import { enterMapCityInteraction } from './enterMapCity.interaction'; import { interactionWithMainboxMainArea } from './mailboxMainArea.interaction'; import { restroomInteractions } from './restroom.interactions'; +import { interactionWithComputer } from './computer.interaction'; +import { interactionWithJokeTeller } from './jokeTeller.interaction'; +import { interactionWithDrinksMachine } from './drink_machine.interaction'; const interactions = [ restroomInteractions, From a8acb7a66bd04dc6c3baac2df70c5955a171ee21 Mon Sep 17 00:00:00 2001 From: Miro Date: Mon, 7 Oct 2024 12:12:17 -0700 Subject: [PATCH 4/6] Adding missing map_arcade and map_city interactions --- src/interactions/map_start/index.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/interactions/map_start/index.js b/src/interactions/map_start/index.js index 318acb46..4a65917e 100644 --- a/src/interactions/map_start/index.js +++ b/src/interactions/map_start/index.js @@ -5,6 +5,10 @@ import { restroomInteractions } from './restroom.interactions'; import { interactionWithComputer } from './computer.interaction'; import { interactionWithJokeTeller } from './jokeTeller.interaction'; import { interactionWithDrinksMachine } from './drink_machine.interaction'; +import { interactionWithMisterFu } from './misterFu.interaction'; +import { interactionWithTV } from './tv_main_room.interaction'; +import { interactionWithCake } from './cake.interaction'; +import { interactionWithLocker } from './locker.interaction'; const interactions = [ restroomInteractions, From 7dd0ef632a390b562417a3da6b03a257e0f23418 Mon Sep 17 00:00:00 2001 From: Miro Date: Mon, 7 Oct 2024 12:44:20 -0700 Subject: [PATCH 5/6] Fixing GameMachine interactions --- src/interactions/map_arcade/index.js | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/src/interactions/map_arcade/index.js b/src/interactions/map_arcade/index.js index 2e23dbb0..5d8d764d 100644 --- a/src/interactions/map_arcade/index.js +++ b/src/interactions/map_arcade/index.js @@ -1,22 +1,13 @@ import { storeMainAreaInteraction } from '../map_city/enterStoreMainArea.interaction'; import { enterMapCityInteraction } from './enterMapCity.interactions'; -import { interactionWithGameMachine2 } from './game_machine_2.interactions'; -import { interactionWithGameMachine4 } from './game_machine_4.interactions'; -import { interactionWithGameMachine6 } from './game_machine_6.interactions'; const interactions = [ enterMapCityInteraction, // Add more interactions here -<<<<<<< HEAD storeMainAreaInteraction, - interactionWithArcadeArea -======= - - // new interaction + interactionWithArcadeArea, interactionWithGameMachine2, - interactionWithGameMachine4, - interactionWithGameMachine6, ->>>>>>> 9e9f897d07f0657ac27665dadd59bf5fb272dc7f + interactionWithGameMachine6 ]; export const attachInteractions = (gameObj, k) => { From 5bd18e5e6351ac8fbcbf68aaaae638162b8c8f2f Mon Sep 17 00:00:00 2001 From: Miro Date: Mon, 7 Oct 2024 12:47:18 -0700 Subject: [PATCH 6/6] Adding in map_start interactions --- src/interactions/map_start/index.js | 24 +++++------------------- 1 file changed, 5 insertions(+), 19 deletions(-) diff --git a/src/interactions/map_start/index.js b/src/interactions/map_start/index.js index 39df6ea4..30e5ef3d 100644 --- a/src/interactions/map_start/index.js +++ b/src/interactions/map_start/index.js @@ -1,12 +1,10 @@ import { interactionWithBruno } from './bruno.interaction'; -import { enterMapCityLeftInteraction } from './enterMapCityLeft.interaction'; -import { enterMapCityRightInteraction } from './enterMapCityRight.interactions'; +import { enterMapCityInteraction } from './enterMapCity.interaction'; import { interactionWithMainboxMainArea } from './mailboxMainArea.interaction'; import { restroomInteractions } from './restroom.interactions'; import { interactionWithComputer } from './computer.interaction'; import { interactionWithJokeTeller } from './jokeTeller.interaction'; import { interactionWithDrinksMachine } from './drink_machine.interaction'; - import { interactionWithMisterFu } from './misterFu.interaction'; import { interactionWithTV } from './tv_main_room.interaction'; import { interactionWithCake } from './cake.interaction'; @@ -15,17 +13,17 @@ import { interactionWithLocker } from './locker.interaction'; const interactions = [ restroomInteractions, interactionWithBruno, - enterMapCityLeftInteraction, - enterMapCityRightInteraction, + enterMapCityInteraction, interactionWithMainboxMainArea, interactionWithComputer, + // Add more interactions here + interactionWithStoreMainArea, interactionWithJokeTeller, interactionWithDrinksMachine, - // Add more interactions here interactionWithMisterFu, interactionWithTV, interactionWithCake, - interactionWithLocker, + interactionWithLocker ]; export const attachInteractions = (gameObj, k) => { @@ -33,15 +31,3 @@ export const attachInteractions = (gameObj, k) => { interactions.forEach((cb) => cb(gameObj, k, map)); }; - -import { interactionWithBruno } from './bruno.interaction'; -import { enterMapCityInteraction } from './enterMapCity.interaction'; -import { interactionWithMainboxMainArea } from './mailboxMainArea.interaction'; -import { restroomInteractions } from './restroom.interactions'; -import { interactionWithComputer } from './computer.interaction'; -import { interactionWithJokeTeller } from './jokeTeller.interaction'; -import { interactionWithDrinksMachine } from './drink_machine.interaction'; -import { interactionWithMisterFu } from './misterFu.interaction'; -import { interactionWithTV } from './tv_main_room.interaction'; -import { interactionWithCake } from './cake.interaction'; -import { interactionWithLocker } from './locker.interaction';