diff --git a/assets/backgrounds/bathroom/bathroomBg.png b/assets/backgrounds/bathroom/bathroomBg.png new file mode 100644 index 0000000..03e111e Binary files /dev/null and b/assets/backgrounds/bathroom/bathroomBg.png differ diff --git a/assets/backgrounds/bathroom/bathroomDoorClosed.png b/assets/backgrounds/bathroom/bathroomDoorClosed.png new file mode 100644 index 0000000..86f73c2 Binary files /dev/null and b/assets/backgrounds/bathroom/bathroomDoorClosed.png differ diff --git a/assets/backgrounds/bathroom/bathroomDoorOpened.png b/assets/backgrounds/bathroom/bathroomDoorOpened.png new file mode 100644 index 0000000..15ea81e Binary files /dev/null and b/assets/backgrounds/bathroom/bathroomDoorOpened.png differ diff --git a/assets/backgrounds/bathroom/bathroomStall1Closed.png b/assets/backgrounds/bathroom/bathroomStall1Closed.png new file mode 100644 index 0000000..4d8c8ee Binary files /dev/null and b/assets/backgrounds/bathroom/bathroomStall1Closed.png differ diff --git a/assets/backgrounds/bathroom/bathroomStall1Opened.png b/assets/backgrounds/bathroom/bathroomStall1Opened.png new file mode 100644 index 0000000..f6a08a3 Binary files /dev/null and b/assets/backgrounds/bathroom/bathroomStall1Opened.png differ diff --git a/assets/backgrounds/bathroom/bathroomStall2Closed.png b/assets/backgrounds/bathroom/bathroomStall2Closed.png new file mode 100644 index 0000000..1984613 Binary files /dev/null and b/assets/backgrounds/bathroom/bathroomStall2Closed.png differ diff --git a/assets/backgrounds/bathroom/bathroomStall2Opened.png b/assets/backgrounds/bathroom/bathroomStall2Opened.png new file mode 100644 index 0000000..f4c78f2 Binary files /dev/null and b/assets/backgrounds/bathroom/bathroomStall2Opened.png differ diff --git a/assets/backgrounds/bathroom/stolenPhone.png b/assets/backgrounds/bathroom/stolenPhone.png new file mode 100644 index 0000000..5a739d6 Binary files /dev/null and b/assets/backgrounds/bathroom/stolenPhone.png differ diff --git a/assets/backgrounds/classBack/backChar1.png b/assets/backgrounds/classBack/backChar1.png new file mode 100644 index 0000000..fcfc7ab Binary files /dev/null and b/assets/backgrounds/classBack/backChar1.png differ diff --git a/assets/backgrounds/classBack/backChar10.png b/assets/backgrounds/classBack/backChar10.png new file mode 100644 index 0000000..7576d0d Binary files /dev/null and b/assets/backgrounds/classBack/backChar10.png differ diff --git a/assets/backgrounds/classBack/backChar11.png b/assets/backgrounds/classBack/backChar11.png new file mode 100644 index 0000000..21ee93e Binary files /dev/null and b/assets/backgrounds/classBack/backChar11.png differ diff --git a/assets/backgrounds/classBack/backChar12.png b/assets/backgrounds/classBack/backChar12.png new file mode 100644 index 0000000..ba1156d Binary files /dev/null and b/assets/backgrounds/classBack/backChar12.png differ diff --git a/assets/backgrounds/classBack/backChar13.png b/assets/backgrounds/classBack/backChar13.png new file mode 100644 index 0000000..1240f5c Binary files /dev/null and b/assets/backgrounds/classBack/backChar13.png differ diff --git a/assets/backgrounds/classBack/backChar14.png b/assets/backgrounds/classBack/backChar14.png new file mode 100644 index 0000000..3524135 Binary files /dev/null and b/assets/backgrounds/classBack/backChar14.png differ diff --git a/assets/backgrounds/classBack/backChar15.png b/assets/backgrounds/classBack/backChar15.png new file mode 100644 index 0000000..5a3facf Binary files /dev/null and b/assets/backgrounds/classBack/backChar15.png differ diff --git a/assets/backgrounds/classBack/backChar2.png b/assets/backgrounds/classBack/backChar2.png new file mode 100644 index 0000000..5229c60 Binary files /dev/null and b/assets/backgrounds/classBack/backChar2.png differ diff --git a/assets/backgrounds/classBack/backChar3.png b/assets/backgrounds/classBack/backChar3.png new file mode 100644 index 0000000..249b693 Binary files /dev/null and b/assets/backgrounds/classBack/backChar3.png differ diff --git a/assets/backgrounds/classBack/backChar4.png b/assets/backgrounds/classBack/backChar4.png new file mode 100644 index 0000000..7d35c33 Binary files /dev/null and b/assets/backgrounds/classBack/backChar4.png differ diff --git a/assets/backgrounds/classBack/backChar5.png b/assets/backgrounds/classBack/backChar5.png new file mode 100644 index 0000000..fff65aa Binary files /dev/null and b/assets/backgrounds/classBack/backChar5.png differ diff --git a/assets/backgrounds/classBack/backChar6.png b/assets/backgrounds/classBack/backChar6.png new file mode 100644 index 0000000..0891e74 Binary files /dev/null and b/assets/backgrounds/classBack/backChar6.png differ diff --git a/assets/backgrounds/classBack/backChar7.png b/assets/backgrounds/classBack/backChar7.png new file mode 100644 index 0000000..174e27c Binary files /dev/null and b/assets/backgrounds/classBack/backChar7.png differ diff --git a/assets/backgrounds/classBack/backChar8.png b/assets/backgrounds/classBack/backChar8.png new file mode 100644 index 0000000..ab02773 Binary files /dev/null and b/assets/backgrounds/classBack/backChar8.png differ diff --git a/assets/backgrounds/classBack/backChar9.png b/assets/backgrounds/classBack/backChar9.png new file mode 100644 index 0000000..de056d9 Binary files /dev/null and b/assets/backgrounds/classBack/backChar9.png differ diff --git a/assets/backgrounds/classBack/backRow1Chairs.png b/assets/backgrounds/classBack/backRow1Chairs.png new file mode 100644 index 0000000..dd143ea Binary files /dev/null and b/assets/backgrounds/classBack/backRow1Chairs.png differ diff --git a/assets/backgrounds/classBack/backRow1Tables.png b/assets/backgrounds/classBack/backRow1Tables.png new file mode 100644 index 0000000..582425c Binary files /dev/null and b/assets/backgrounds/classBack/backRow1Tables.png differ diff --git a/assets/backgrounds/classBack/backRow2Chairs.png b/assets/backgrounds/classBack/backRow2Chairs.png new file mode 100644 index 0000000..542cd77 Binary files /dev/null and b/assets/backgrounds/classBack/backRow2Chairs.png differ diff --git a/assets/backgrounds/classBack/backRow2Tables.png b/assets/backgrounds/classBack/backRow2Tables.png new file mode 100644 index 0000000..d024007 Binary files /dev/null and b/assets/backgrounds/classBack/backRow2Tables.png differ diff --git a/assets/backgrounds/classBack/backRow3Chairs.png b/assets/backgrounds/classBack/backRow3Chairs.png new file mode 100644 index 0000000..70310e7 Binary files /dev/null and b/assets/backgrounds/classBack/backRow3Chairs.png differ diff --git a/assets/backgrounds/classBack/backRow3Tables.png b/assets/backgrounds/classBack/backRow3Tables.png new file mode 100644 index 0000000..56dd9c7 Binary files /dev/null and b/assets/backgrounds/classBack/backRow3Tables.png differ diff --git a/assets/backgrounds/classBack/backRow4Chairs.png b/assets/backgrounds/classBack/backRow4Chairs.png new file mode 100644 index 0000000..d1b4f92 Binary files /dev/null and b/assets/backgrounds/classBack/backRow4Chairs.png differ diff --git a/assets/backgrounds/classBack/backRow4Tables.png b/assets/backgrounds/classBack/backRow4Tables.png new file mode 100644 index 0000000..1828917 Binary files /dev/null and b/assets/backgrounds/classBack/backRow4Tables.png differ diff --git a/assets/backgrounds/classBack/backRow5Chairs.png b/assets/backgrounds/classBack/backRow5Chairs.png new file mode 100644 index 0000000..5e7ad29 Binary files /dev/null and b/assets/backgrounds/classBack/backRow5Chairs.png differ diff --git a/assets/backgrounds/classBack/backRow5Tables.png b/assets/backgrounds/classBack/backRow5Tables.png new file mode 100644 index 0000000..2a6be57 Binary files /dev/null and b/assets/backgrounds/classBack/backRow5Tables.png differ diff --git a/assets/backgrounds/classBack/blackboardPic1.png b/assets/backgrounds/classBack/blackboardPic1.png new file mode 100644 index 0000000..ed67e0d Binary files /dev/null and b/assets/backgrounds/classBack/blackboardPic1.png differ diff --git a/assets/backgrounds/classBack/blackboardPic2.png b/assets/backgrounds/classBack/blackboardPic2.png new file mode 100644 index 0000000..0e9a543 Binary files /dev/null and b/assets/backgrounds/classBack/blackboardPic2.png differ diff --git a/assets/backgrounds/classBack/blackboardPic3.png b/assets/backgrounds/classBack/blackboardPic3.png new file mode 100644 index 0000000..c244492 Binary files /dev/null and b/assets/backgrounds/classBack/blackboardPic3.png differ diff --git a/assets/backgrounds/classBack/classBackBg.png b/assets/backgrounds/classBack/classBackBg.png new file mode 100644 index 0000000..555e6a6 Binary files /dev/null and b/assets/backgrounds/classBack/classBackBg.png differ diff --git a/assets/backgrounds/classBack/classDoorClosed.png b/assets/backgrounds/classBack/classDoorClosed.png new file mode 100644 index 0000000..68aecf7 Binary files /dev/null and b/assets/backgrounds/classBack/classDoorClosed.png differ diff --git a/assets/backgrounds/classBack/classDoorOpened.png b/assets/backgrounds/classBack/classDoorOpened.png new file mode 100644 index 0000000..dc4034e Binary files /dev/null and b/assets/backgrounds/classBack/classDoorOpened.png differ diff --git a/assets/backgrounds/classFront/classFrontBg.png b/assets/backgrounds/classFront/classFrontBg.png new file mode 100644 index 0000000..a843c30 Binary files /dev/null and b/assets/backgrounds/classFront/classFrontBg.png differ diff --git a/assets/backgrounds/classFront/frontChar1.png b/assets/backgrounds/classFront/frontChar1.png new file mode 100644 index 0000000..9985494 Binary files /dev/null and b/assets/backgrounds/classFront/frontChar1.png differ diff --git a/assets/backgrounds/classFront/frontChar10.png b/assets/backgrounds/classFront/frontChar10.png new file mode 100644 index 0000000..afca01a Binary files /dev/null and b/assets/backgrounds/classFront/frontChar10.png differ diff --git a/assets/backgrounds/classFront/frontChar11.png b/assets/backgrounds/classFront/frontChar11.png new file mode 100644 index 0000000..03ca72c Binary files /dev/null and b/assets/backgrounds/classFront/frontChar11.png differ diff --git a/assets/backgrounds/classFront/frontChar12.png b/assets/backgrounds/classFront/frontChar12.png new file mode 100644 index 0000000..6feb57f Binary files /dev/null and b/assets/backgrounds/classFront/frontChar12.png differ diff --git a/assets/backgrounds/classFront/frontChar13.png b/assets/backgrounds/classFront/frontChar13.png new file mode 100644 index 0000000..e74cc5f Binary files /dev/null and b/assets/backgrounds/classFront/frontChar13.png differ diff --git a/assets/backgrounds/classFront/frontChar14.png b/assets/backgrounds/classFront/frontChar14.png new file mode 100644 index 0000000..5edeb15 Binary files /dev/null and b/assets/backgrounds/classFront/frontChar14.png differ diff --git a/assets/backgrounds/classFront/frontChar15.png b/assets/backgrounds/classFront/frontChar15.png new file mode 100644 index 0000000..c7580bf Binary files /dev/null and b/assets/backgrounds/classFront/frontChar15.png differ diff --git a/assets/backgrounds/classFront/frontChar2.png b/assets/backgrounds/classFront/frontChar2.png new file mode 100644 index 0000000..3450034 Binary files /dev/null and b/assets/backgrounds/classFront/frontChar2.png differ diff --git a/assets/backgrounds/classFront/frontChar3.png b/assets/backgrounds/classFront/frontChar3.png new file mode 100644 index 0000000..a5e216c Binary files /dev/null and b/assets/backgrounds/classFront/frontChar3.png differ diff --git a/assets/backgrounds/classFront/frontChar4.png b/assets/backgrounds/classFront/frontChar4.png new file mode 100644 index 0000000..e9c9bd9 Binary files /dev/null and b/assets/backgrounds/classFront/frontChar4.png differ diff --git a/assets/backgrounds/classFront/frontChar5.png b/assets/backgrounds/classFront/frontChar5.png new file mode 100644 index 0000000..2f9b42f Binary files /dev/null and b/assets/backgrounds/classFront/frontChar5.png differ diff --git a/assets/backgrounds/classFront/frontChar6.png b/assets/backgrounds/classFront/frontChar6.png new file mode 100644 index 0000000..34784f2 Binary files /dev/null and b/assets/backgrounds/classFront/frontChar6.png differ diff --git a/assets/backgrounds/classFront/frontChar7.png b/assets/backgrounds/classFront/frontChar7.png new file mode 100644 index 0000000..11de306 Binary files /dev/null and b/assets/backgrounds/classFront/frontChar7.png differ diff --git a/assets/backgrounds/classFront/frontChar8.png b/assets/backgrounds/classFront/frontChar8.png new file mode 100644 index 0000000..2ce166d Binary files /dev/null and b/assets/backgrounds/classFront/frontChar8.png differ diff --git a/assets/backgrounds/classFront/frontChar9.png b/assets/backgrounds/classFront/frontChar9.png new file mode 100644 index 0000000..4d2986d Binary files /dev/null and b/assets/backgrounds/classFront/frontChar9.png differ diff --git a/assets/backgrounds/classFront/frontRow1Chairs.png b/assets/backgrounds/classFront/frontRow1Chairs.png new file mode 100644 index 0000000..a6310c2 Binary files /dev/null and b/assets/backgrounds/classFront/frontRow1Chairs.png differ diff --git a/assets/backgrounds/classFront/frontRow1Tables.png b/assets/backgrounds/classFront/frontRow1Tables.png new file mode 100644 index 0000000..6b9d08f Binary files /dev/null and b/assets/backgrounds/classFront/frontRow1Tables.png differ diff --git a/assets/backgrounds/classFront/frontRow2Chairs.png b/assets/backgrounds/classFront/frontRow2Chairs.png new file mode 100644 index 0000000..62e7616 Binary files /dev/null and b/assets/backgrounds/classFront/frontRow2Chairs.png differ diff --git a/assets/backgrounds/classFront/frontRow2Tables.png b/assets/backgrounds/classFront/frontRow2Tables.png new file mode 100644 index 0000000..9481d4b Binary files /dev/null and b/assets/backgrounds/classFront/frontRow2Tables.png differ diff --git a/assets/backgrounds/classFront/frontRow3Chairs.png b/assets/backgrounds/classFront/frontRow3Chairs.png new file mode 100644 index 0000000..940ac20 Binary files /dev/null and b/assets/backgrounds/classFront/frontRow3Chairs.png differ diff --git a/assets/backgrounds/classFront/frontRow3Tables.png b/assets/backgrounds/classFront/frontRow3Tables.png new file mode 100644 index 0000000..93a2ed3 Binary files /dev/null and b/assets/backgrounds/classFront/frontRow3Tables.png differ diff --git a/assets/backgrounds/classFront/frontRow4Chairs.png b/assets/backgrounds/classFront/frontRow4Chairs.png new file mode 100644 index 0000000..a676a4a Binary files /dev/null and b/assets/backgrounds/classFront/frontRow4Chairs.png differ diff --git a/assets/backgrounds/classFront/frontRow4Tables.png b/assets/backgrounds/classFront/frontRow4Tables.png new file mode 100644 index 0000000..1b17162 Binary files /dev/null and b/assets/backgrounds/classFront/frontRow4Tables.png differ diff --git a/assets/backgrounds/classFront/frontRow5Chairs.png b/assets/backgrounds/classFront/frontRow5Chairs.png new file mode 100644 index 0000000..8ee5436 Binary files /dev/null and b/assets/backgrounds/classFront/frontRow5Chairs.png differ diff --git a/assets/backgrounds/classFront/frontRow5Tables.png b/assets/backgrounds/classFront/frontRow5Tables.png new file mode 100644 index 0000000..e858ab6 Binary files /dev/null and b/assets/backgrounds/classFront/frontRow5Tables.png differ diff --git a/assets/backgrounds/corridor/boysDoorClosed.png b/assets/backgrounds/corridor/boysDoorClosed.png new file mode 100644 index 0000000..141c6d3 Binary files /dev/null and b/assets/backgrounds/corridor/boysDoorClosed.png differ diff --git a/assets/backgrounds/corridor/boysDoorOpened.png b/assets/backgrounds/corridor/boysDoorOpened.png new file mode 100644 index 0000000..76ba6ee Binary files /dev/null and b/assets/backgrounds/corridor/boysDoorOpened.png differ diff --git a/assets/backgrounds/corridor/classDoorClosed.png b/assets/backgrounds/corridor/classDoorClosed.png new file mode 100644 index 0000000..0e58335 Binary files /dev/null and b/assets/backgrounds/corridor/classDoorClosed.png differ diff --git a/assets/backgrounds/corridor/classDoorOpened.png b/assets/backgrounds/corridor/classDoorOpened.png new file mode 100644 index 0000000..c48782f Binary files /dev/null and b/assets/backgrounds/corridor/classDoorOpened.png differ diff --git a/assets/backgrounds/corridor/corridorBg.png b/assets/backgrounds/corridor/corridorBg.png new file mode 100644 index 0000000..f9819e0 Binary files /dev/null and b/assets/backgrounds/corridor/corridorBg.png differ diff --git a/assets/backgrounds/corridor/girlsDoorClosed.png b/assets/backgrounds/corridor/girlsDoorClosed.png new file mode 100644 index 0000000..0b7f573 Binary files /dev/null and b/assets/backgrounds/corridor/girlsDoorClosed.png differ diff --git a/assets/backgrounds/corridor/girlsDoorOpened.png b/assets/backgrounds/corridor/girlsDoorOpened.png new file mode 100644 index 0000000..a7926a1 Binary files /dev/null and b/assets/backgrounds/corridor/girlsDoorOpened.png differ diff --git a/assets/backgrounds/nightmares/gum.png b/assets/backgrounds/nightmares/gum.png new file mode 100644 index 0000000..8d38b6d Binary files /dev/null and b/assets/backgrounds/nightmares/gum.png differ diff --git a/assets/backgrounds/nightmares/gumChair.png b/assets/backgrounds/nightmares/gumChair.png new file mode 100644 index 0000000..197cf2a Binary files /dev/null and b/assets/backgrounds/nightmares/gumChair.png differ diff --git a/assets/backgrounds/nightmares/nightmaresBg.png b/assets/backgrounds/nightmares/nightmaresBg.png new file mode 100644 index 0000000..7fdcd5b Binary files /dev/null and b/assets/backgrounds/nightmares/nightmaresBg.png differ diff --git a/assets/backgrounds/nightmares/nightmaresChair.png b/assets/backgrounds/nightmares/nightmaresChair.png new file mode 100644 index 0000000..5ca9f7c Binary files /dev/null and b/assets/backgrounds/nightmares/nightmaresChair.png differ diff --git a/assets/backgrounds/playground/earring.png b/assets/backgrounds/playground/earring.png new file mode 100644 index 0000000..19d0f56 Binary files /dev/null and b/assets/backgrounds/playground/earring.png differ diff --git a/assets/backgrounds/playground/playgroundClosed.png b/assets/backgrounds/playground/playgroundClosed.png new file mode 100644 index 0000000..dd99477 Binary files /dev/null and b/assets/backgrounds/playground/playgroundClosed.png differ diff --git a/assets/backgrounds/playground/playgroundOpened.png b/assets/backgrounds/playground/playgroundOpened.png new file mode 100644 index 0000000..ef94f6e Binary files /dev/null and b/assets/backgrounds/playground/playgroundOpened.png differ diff --git a/assets/backgrounds/stairs/stairsBg.png b/assets/backgrounds/stairs/stairsBg.png new file mode 100644 index 0000000..9ebfb3c Binary files /dev/null and b/assets/backgrounds/stairs/stairsBg.png differ diff --git a/assets/backgrounds/stairs/stairsDoorClosed.png b/assets/backgrounds/stairs/stairsDoorClosed.png new file mode 100644 index 0000000..7d23892 Binary files /dev/null and b/assets/backgrounds/stairs/stairsDoorClosed.png differ diff --git a/assets/backgrounds/stairs/stairsDoorOpened.png b/assets/backgrounds/stairs/stairsDoorOpened.png new file mode 100644 index 0000000..83e7417 Binary files /dev/null and b/assets/backgrounds/stairs/stairsDoorOpened.png differ diff --git a/localization/day1/livingroomMorningDay1.json b/localization/day1/livingroomMorningDay1.json index e7e8144..51dcc93 100644 --- a/localization/day1/livingroomMorningDay1.json +++ b/localization/day1/livingroomMorningDay1.json @@ -121,5 +121,26 @@ "type": "text", "character": "mom" } + }, + + + "door": { + "root": { + "type": "condition", + "conditions": [ + { + "next": "noBag", + "bagPicked": { + "value": false, + "operator": "equal", + "default": false + } + } + ] + }, + "noBag": { + "type": "text", + "character": "player" + } } } \ No newline at end of file diff --git a/localization/en/day1/livingroomMorningDay1.json b/localization/en/day1/livingroomMorningDay1.json index f4a963e..a1764e6 100644 --- a/localization/en/day1/livingroomMorningDay1.json +++ b/localization/en/day1/livingroomMorningDay1.json @@ -41,7 +41,11 @@ "text": "Está en tu cuarto, cogela y vete ya." } ] - } + }, - + "door": { + "noBag": { + "text": "Me dejo la mochila. Será mejor que pases por mi habitación a recogerla antes de irme." + } + } } \ No newline at end of file diff --git a/localization/es/day1/livingroomMorningDay1.json b/localization/es/day1/livingroomMorningDay1.json index f4a963e..a2dc296 100644 --- a/localization/es/day1/livingroomMorningDay1.json +++ b/localization/es/day1/livingroomMorningDay1.json @@ -41,7 +41,12 @@ "text": "Está en tu cuarto, cogela y vete ya." } ] - } + }, + "door": { + "noBag": { + "text": "Me dejo la mochila. Será mejor que pases por mi habitación a recogerla antes de irme." + } + } } \ No newline at end of file diff --git a/src/game.js b/src/game.js index fbe6023..4a0cd9a 100644 --- a/src/game.js +++ b/src/game.js @@ -7,6 +7,9 @@ import TextOnlyScene from './scenes/textOnlyScene.js'; import AlarmScene from './scenes/gameLoop/alarmScene.js'; import BedroomMorningDay1 from './scenes/gameLoop/day1/bedroomMorningDay1.js'; import LivingroomMorningDay1 from './scenes/gameLoop/day1/livingroomMorningDay1.js'; +import PlaygroundMorningDay1 from './scenes/gameLoop/day1/playgroundMorningDay1.js'; +import StairsMorningDay1 from './scenes/gameLoop/day1/stairsMorningDay1.js'; +import CorridorMorningDay1 from './scenes/gameLoop/day1/corridorMorningDay1.js'; import ComputerScene from './UI/computer/computerScene.js' @@ -27,9 +30,10 @@ const config = { // Nota: el orden de las escenas es relevante. Las que se encuentran delante, se renderizan delante scene: [ BootScene, LanguageMenu, TitleMenu, UserInfoMenu, - TextOnlyScene, AlarmScene, BedroomMorningDay1, LivingroomMorningDay1, - Test, TestMenu, ComputerScene, - UIManager,], + TextOnlyScene, AlarmScene, + BedroomMorningDay1, LivingroomMorningDay1, PlaygroundMorningDay1, StairsMorningDay1, CorridorMorningDay1, + Test, TestMenu, + ComputerScene, UIManager,], autoFocus: true, disableContextMenu: true, // Desactivar que aparezca el menu de inspeccionar al hacer click derecho render: { diff --git a/src/managers/gameManager.js b/src/managers/gameManager.js index 190298b..8196ff9 100644 --- a/src/managers/gameManager.js +++ b/src/managers/gameManager.js @@ -39,7 +39,7 @@ export default class GameManager { this.blackboard = new Map(); this.bagPicked = "bagPicked"; - this.blackboard.set("bagPicked", false); + this.blackboard.set(this.bagPicked, false); this.isLate = "isLate"; this.blackboard.set(this.isLate, false); @@ -239,7 +239,7 @@ export default class GameManager { this.computerScene.scene.sleep(); - let sceneName = 'LivingroomMorningDay1'; + let sceneName = 'StairsMorningDay1'; // Pasa a la escena inicial con los parametros text, onComplete y onCompleteDelay // let sceneName = 'TextOnlyScene'; @@ -315,7 +315,7 @@ export default class GameManager { // Se cambia a la escena actual de vuelta, que deberia ser la // habitacion, y deberia ponerse la camara en la izquierda let params = { - left: true + camPos: "left" }; this.currentScene.scene.wake(); this.currentScene.params = params; diff --git a/src/scenes/bootScene.js b/src/scenes/bootScene.js index 43de2eb..959c0ea 100644 --- a/src/scenes/bootScene.js +++ b/src/scenes/bootScene.js @@ -220,6 +220,103 @@ export default class BootScene extends Phaser.Scene { this.load.image('living_playDoorClosed', 'livingroom/livingroomDoorClosed.png'); this.load.image('living_playDoorOpened', 'livingroom/livingroomDoorOpened.png'); + + // Patio + this.load.image('playgroundClosed', 'playground/playgroundClosed.png'); + this.load.image('playgroundOpened', 'playground/playgroundOpened.png'); + // this.load.image('earring', 'playground/earring.png'); + + // Escaleras + this.load.image('stairsBg', 'stairs/stairsBg.png'); + this.load.image('stairsDoorClosed', 'stairs/stairsDoorClosed.png'); + this.load.image('stairsDoorOpened', 'stairs/stairsDoorOpened.png'); + + // Pasillo + this.load.image('corridorBg', 'corridor/corridorBg.png'); + // this.load.image('boysDoorClosed', 'corridor/boysDoorClosed.png'); + // this.load.image('boysDoorOpened', 'corridor/boysDoorOpened.png'); + // this.load.image('girlsDoorClosed', 'corridor/girlsDoorClosed.png'); + // this.load.image('girlsDoorOpened', 'corridor/girlsDoorOpened.png'); + // this.load.image('classDoorClosed', 'corridor/classDoorClosed.png'); + // this.load.image('classDoorOpened', 'corridor/classDoorOpened.png'); + + // Banos + this.load.image('bathroomBg', 'bathroom/bathroomBg.png'); + // this.load.image('bathroomDoorClosed', 'bathroom/bathroomDoorClosed.png'); + // this.load.image('bathroomDoorOpened', 'bathroom/bathroomDoorOpened.png'); + // this.load.image('bathroomStall1Closed', 'bathroom/bathroomStall1Closed.png'); + // this.load.image('bathroomStall1Opened', 'bathroom/bathroomStall1Opened.png'); + // this.load.image('bathroomstall2Closed', 'bathroom/bathroomstall2Closed.png'); + // this.load.image('bathroomstall2Opened', 'bathroom/bathroomstall2Opened.png'); + // this.load.image('stolenPhone', 'bathroom/stolenPhone.png'); + + // Clase desde el frente + this.load.image('classFrontBg', 'classFront/classFrontBg.png'); + // this.load.image('frontChar1', 'classFront/frontChar1.png'); + // this.load.image('frontChar2', 'classFront/frontChar2.png'); + // this.load.image('frontChar3', 'classFront/frontChar3.png'); + // this.load.image('frontChar4', 'classFront/frontChar4.png'); + // this.load.image('frontChar5', 'classFront/frontChar5.png'); + // this.load.image('frontChar6', 'classFront/frontChar6.png'); + // this.load.image('frontChar7', 'classFront/frontChar7.png'); + // this.load.image('frontChar8', 'classFront/frontChar8.png'); + // this.load.image('frontChar9', 'classFront/frontChar9.png'); + // this.load.image('frontChar10', 'classFront/frontChar10.png'); + // this.load.image('frontChar11', 'classFront/frontChar11.png'); + // this.load.image('frontChar12', 'classFront/frontChar12.png'); + // this.load.image('frontChar13', 'classFront/frontChar13.png'); + // this.load.image('frontChar14', 'classFront/frontChar14.png'); + // this.load.image('frontChar15', 'classFront/frontChar15.png'); + // this.load.image('frontRow1Chairs', 'classFront/frontRow1Chairs.png'); + // this.load.image('frontRow1Tables', 'classFront/frontRow1Tables.png'); + // this.load.image('frontRow2Chairs', 'classFront/frontRow2Chairs.png'); + // this.load.image('frontRow2Tables', 'classFront/frontRow2Tables.png'); + // this.load.image('frontRow3Chairs', 'classFront/frontRow3Chairs.png'); + // this.load.image('frontRow3Tables', 'classFront/frontRow3Tables.png'); + // this.load.image('frontRow4Chairs', 'classFront/frontRow4Chairs.png'); + // this.load.image('frontRow4Tables', 'classFront/frontRow4Tables.png'); + // this.load.image('frontRow5Chairs', 'classFront/frontRow5Chairs.png'); + // this.load.image('frontRow5Tables', 'classFront/frontRow5Tables.png'); + + // Clase desde el fondo + this.load.image('classBackBg', 'classBack/classBackBg.png'); + // this.load.image('backChar1', 'classBack/backChar1.png'); + // this.load.image('backChar2', 'classBack/backChar2.png'); + // this.load.image('backChar3', 'classBack/backChar3.png'); + // this.load.image('backChar4', 'classBack/backChar4.png'); + // this.load.image('backChar5', 'classBack/backChar5.png'); + // this.load.image('backChar6', 'classBack/backChar6.png'); + // this.load.image('backChar7', 'classBack/backChar7.png'); + // this.load.image('backChar8', 'classBack/backChar8.png'); + // this.load.image('backChar9', 'classBack/backChar9.png'); + // this.load.image('backChar10', 'classBack/backChar10.png'); + // this.load.image('backChar11', 'classBack/backChar11.png'); + // this.load.image('backChar12', 'classBack/backChar12.png'); + // this.load.image('backChar13', 'classBack/backChar13.png'); + // this.load.image('backChar14', 'classBack/backChar14.png'); + // this.load.image('backChar15', 'classBack/backChar15.png'); + // this.load.image('backRow1Chairs', 'classBack/backRow1Chairs.png'); + // this.load.image('backRow1Tables', 'classBack/backRow1Tables.png'); + // this.load.image('backRow2Chairs', 'classBack/backRow2Chairs.png'); + // this.load.image('backRow2Tables', 'classBack/backRow2Tables.png'); + // this.load.image('backRow3Chairs', 'classBack/backRow3Chairs.png'); + // this.load.image('backRow3Tables', 'classBack/backRow3Tables.png'); + // this.load.image('backRow4Chairs', 'classBack/backRow4Chairs.png'); + // this.load.image('backRow4Tables', 'classBack/backRow4Tables.png'); + // this.load.image('backRow5Chairs', 'classBack/backRow5Chairs.png'); + // this.load.image('backRow5Tables', 'classBack/backRow5Tables.png'); + // this.load.image('blackboardPic1', 'classBack/blackboardPic1.png'); + // this.load.image('blackboardPic2', 'classBack/blackboardPic2.png'); + // this.load.image('blackboardPic3', 'classBack/blackboardPic3.png'); + // this.load.image('class_corridorDoorClosed', 'classBack/classDoorClosed.png'); + // this.load.image('class_corridorDoorOpened', 'classBack/classDoorOpened.png'); + + // Pesadillas + this.load.image('nightmaresBg', 'nightmares/nightmaresBg.png'); + // this.load.image('gum', 'nightmares/gum.png'); + // this.load.image('gumChair', 'nightmares/gumChair.png'); + // this.load.image('nightmaresChair', 'nightmares/nightmaresChair.png'); + } preload() { diff --git a/src/scenes/gameLoop/baseScene.js b/src/scenes/gameLoop/baseScene.js index 76afa0c..79f8b86 100644 --- a/src/scenes/gameLoop/baseScene.js +++ b/src/scenes/gameLoop/baseScene.js @@ -96,11 +96,15 @@ export default class BaseScene extends Phaser.Scene { // console.log(params); this.dialogManager.changeScene(this); + + // Por defecto se pone la camara en el centro y si hay parametros que indiquen + // donde colocar la camara, se coloca a la izquierda o a la derecha + this.cameras.main.scrollX = this.rightBound / 2 - this.CANVAS_WIDTH / 2; if (params) { - if (params.left === undefined || params.left === true) { + if (params.camPos === "left") { this.cameras.main.scrollX = this.leftBound; } - else { + else if (params.camPos === "right") { this.cameras.main.scrollX = this.rightBound - this.CANVAS_WIDTH; } } @@ -492,11 +496,12 @@ export default class BaseScene extends Phaser.Scene { * al interactuar con ella (al hacer click o al pasar/sacar el raton por encima) * @param {Phaser.Image} closed - imagen de la puerta cerrada * @param {Phaser.Image} opened - imagen de la puerta abierta + * @param {Function} onClick - funcion a la que se llamara al hacer click sobre la puerta abierta * @param {Boolean} click - true si la imagen se cambia al hacer click, false si lo hace al pasar/sacar el raton por encima */ - toggleDoor(closed, opened, click = true) { - closed.setInteractive({ useHandCursor: true }); - opened.setInteractive({ useHandCursor: true }); + toggleDoor(closed, opened, onClick = { }, click = true) { + closed.setInteractive({ useHandCursor: true }); + opened.setInteractive({ useHandCursor: true }); opened.visible = false; let openEvt = 'pointerdown'; @@ -515,6 +520,12 @@ export default class BaseScene extends Phaser.Scene { opened.visible = false; closed.visible = true; }); + + opened.on('pointerdown', () => { + if (onClick !== null && typeof onClick === 'function') { + onClick(); + } + }) } } \ No newline at end of file diff --git a/src/scenes/gameLoop/bathroomBase.js b/src/scenes/gameLoop/bathroomBase.js new file mode 100644 index 0000000..0163ef7 --- /dev/null +++ b/src/scenes/gameLoop/bathroomBase.js @@ -0,0 +1,26 @@ + +import BaseScene from './baseScene.js'; + +export default class BathroomBase extends BaseScene { + /** + * Escena base para los banos. Coloca los elementos que se mantienen igual todos los dias + * @extends BaseScene + * @param {String} name - id de la escena + */ + constructor(name) { + super(name); + } + + create(params) { + super.create(params); + + this.corridor = ""; + + // Pone la imagen de fondo con las dimensiones del canvas + let bg = this.add.image(0, 0, 'bathroomBg').setOrigin(0, 0); + this.scale = this.CANVAS_HEIGHT / bg.height; + bg.setScale(this.scale); + + this.rightBound = bg.displayWidth; + } +} \ No newline at end of file diff --git a/src/scenes/gameLoop/bedroomBase.js b/src/scenes/gameLoop/bedroomBase.js index 6e0e49c..3f2bd37 100644 --- a/src/scenes/gameLoop/bedroomBase.js +++ b/src/scenes/gameLoop/bedroomBase.js @@ -3,23 +3,14 @@ import BaseScene from './baseScene.js'; export default class BedroomBase extends BaseScene { /** - * Escena base para la habitacion. Coloca los elementos comunes a - * la habitacion de todos los dias (cama, puerta, mesa, armarios...) + * Escena base para la habitacion. Coloca los elementos que se mantienen igual todos los dias * @extends BaseScene * @param {String} name - id de la escena */ constructor(name) { super(name); } - - // Metodo que se llama al terminar de crear la escena. - onCreate(params) { - super.onCreate(params); - - this.phoneManager.topLid.visible = false; - this.phoneManager.botLid.visible = false; - } - + create(params) { super.create(params); @@ -59,7 +50,7 @@ export default class BedroomBase extends BaseScene { door1Closed.setDepth(bg.depth + 3); door1Opened.setDepth(door1Closed.depth - 1); wardrobe1.setDepth(door1Opened.depth - 1); - wardrobe1.setInteractive({ useHandCursor: true }); + wardrobe1.setInteractive({ useHandCursor: true }); wardrobe1.on('pointerdown', () => { if (door1Opened.visible) { this.dialogManager.setNode(this.wardrobe1Node) @@ -72,7 +63,7 @@ export default class BedroomBase extends BaseScene { door3Closed.setDepth(bg.depth + 3); door3Opened.setDepth(door2Closed.depth - 1); wardrobe2.setDepth(door2Opened.depth - 1); - wardrobe2.setInteractive({ useHandCursor: true }); + wardrobe2.setInteractive({ useHandCursor: true }); wardrobe2.on('pointerdown', () => { if (door2Opened.visible || door3Opened.visible) { this.dialogManager.setNode(this.wardrobe2Node) @@ -81,12 +72,11 @@ export default class BedroomBase extends BaseScene { // Ordenador - // Al hacer click sobre el, se cambia el nodo en el dialogManager, y si - // se lanza el evento turnPC, se cambia a la escena del ordenador this.pcNode = null; - let pc = this.add.rectangle(276, 360, 150, 162, 0xfff, 0).setOrigin(0, 0); - pc.setInteractive({ useHandCursor: true }); + pc.setInteractive({ useHandCursor: true }); + // Al hacer click sobre el, se cambia el nodo en el dialogManager, y si + // se lanza el evento turnPC, se cambia a la escena del ordenador pc.on('pointerdown', () => { this.dialogManager.setNode(this.pcNode); }); @@ -100,27 +90,24 @@ export default class BedroomBase extends BaseScene { // Puerta de la habitacion let doorClosed = this.add.image(6, this.CANVAS_HEIGHT, 'bed_livingDoorClosed').setOrigin(0, 1).setScale(this.scale); let doorOpened = this.add.image(6, this.CANVAS_HEIGHT, 'bed_livingDoorOpened').setOrigin(0, 1).setScale(this.scale); - super.toggleDoor(doorClosed, doorOpened, false); - - // Al hacer click sobre la puerta abierta, se - // pasa al salon con la camara en la derecha - doorOpened.on('pointerdown', () => { + // Al hacer click sobre la puerta abierta, se pasa al salon con la camara en la derecha + super.toggleDoor(doorClosed, doorOpened, () => { let params = { - left: false + camPos: "right" }; this.gameManager.changeScene(this.livingroom, params, true); - }); - + }, false); + // Cama - // Al igual que con el interior de los armarios, se recoloca su profundidad y al - // hacer click sobre ella, se cambia el nodo en el dialogManager + // Al igual que con el interior de los armarios, se recoloca su profundidad + // y al hacer click sobre ella, se cambia el nodo en el dialogManager this.bed = this.add.image(bg.displayWidth, this.CANVAS_HEIGHT, 'bed').setOrigin(1, 1).setScale(this.scale); - this.bed.setInteractive({ useHandCursor: true }); + this.bed.setInteractive({ useHandCursor: true }); this.bed.setDepth(10); this.bedNode = null; this.bed.on('pointerdown', () => { - this.dialogManager.setNode(this.bedNode) + this.dialogManager.setNode(this.bedNode); }) diff --git a/src/scenes/gameLoop/classBackBase.js b/src/scenes/gameLoop/classBackBase.js new file mode 100644 index 0000000..974b51b --- /dev/null +++ b/src/scenes/gameLoop/classBackBase.js @@ -0,0 +1,28 @@ + +import BaseScene from './baseScene.js'; + +export default class ClassBackBase extends BaseScene { + /** + * Escena base para el fondo de la clase. Coloca los elementos que se mantienen igual todos los dias + * @extends BaseScene + * @param {String} name - id de la escena + */ + constructor(name) { + super(name); + } + + create(params) { + super.create(params); + + this.corridor = ""; + + this.nextHour = ""; + + // Pone la imagen de fondo con las dimensiones del canvas + let bg = this.add.image(0, 0, 'classBackBg').setOrigin(0, 0); + this.scale = this.CANVAS_HEIGHT / bg.height; + bg.setScale(this.scale); + + this.rightBound = bg.displayWidth; + } +} \ No newline at end of file diff --git a/src/scenes/gameLoop/classFrontBase.js b/src/scenes/gameLoop/classFrontBase.js new file mode 100644 index 0000000..6069b35 --- /dev/null +++ b/src/scenes/gameLoop/classFrontBase.js @@ -0,0 +1,24 @@ + +import BaseScene from './baseScene.js'; + +export default class ClassFrontBase extends BaseScene { + /** + * Escena base para el frente de la clase. Coloca los elementos que se mantienen igual todos los dias + * @extends BaseScene + * @param {String} name - id de la escena + */ + constructor(name) { + super(name); + } + + create(params) { + super.create(params); + + // Pone la imagen de fondo con las dimensiones del canvas + let bg = this.add.image(0, 0, 'classFrontBg').setOrigin(0, 0); + this.scale = this.CANVAS_HEIGHT / bg.height; + bg.setScale(this.scale); + + this.rightBound = bg.displayWidth; + } +} \ No newline at end of file diff --git a/src/scenes/gameLoop/corridorBase.js b/src/scenes/gameLoop/corridorBase.js new file mode 100644 index 0000000..d22d836 --- /dev/null +++ b/src/scenes/gameLoop/corridorBase.js @@ -0,0 +1,30 @@ + +import BaseScene from './baseScene.js'; + +export default class CorridorBase extends BaseScene { + /** + * Escena base para el pasillo. Coloca los elementos que se mantienen igual todos los dias + * @extends BaseScene + * @param {String} name - id de la escena + */ + constructor(name) { + super(name); + } + + create(params) { + super.create(params); + + this.stairs = ""; + this.boysBathroom = ""; + this.girlsBathroom = ""; + + this.nextHour = ""; + + // Pone la imagen de fondo con las dimensiones del canvas + let bg = this.add.image(0, 0, 'corridorBg').setOrigin(0, 0); + this.scale = this.CANVAS_HEIGHT / bg.height; + bg.setScale(this.scale); + + this.rightBound = bg.displayWidth; + } +} \ No newline at end of file diff --git a/src/scenes/gameLoop/day1/bedroomMorningDay1.js b/src/scenes/gameLoop/day1/bedroomMorningDay1.js index 0e38cab..accf650 100644 --- a/src/scenes/gameLoop/day1/bedroomMorningDay1.js +++ b/src/scenes/gameLoop/day1/bedroomMorningDay1.js @@ -20,7 +20,7 @@ export default class BedroomMorningDay1 extends BedroomBase { // Mochila let bagNode = super.readNodes("root", nodes, "day1\\bedroomMorningDay1", "bag", true); let bag = this.add.image(170, this.CANVAS_HEIGHT - 170, 'bag').setOrigin(0, 0).setScale(this.scale); - bag.setInteractive({ useHandCursor: true }); + bag.setInteractive({ useHandCursor: true }); bag.on('pointerdown', () => { this.dialogManager.setNode(bagNode) }); diff --git a/src/scenes/gameLoop/day1/corridorMorningDay1.js b/src/scenes/gameLoop/day1/corridorMorningDay1.js new file mode 100644 index 0000000..5c65de3 --- /dev/null +++ b/src/scenes/gameLoop/day1/corridorMorningDay1.js @@ -0,0 +1,17 @@ +import CorridorBase from "../corridorBase.js"; + +export default class CorridorMorningDay1 extends CorridorBase { + constructor() { + super('CorridorMorningDay1'); + } + + create(params) { + super.create(params); + + this.stairs = "StairsMorningDay1"; + this.boysBathroom = ""; + this.girlsBathroom = ""; + + + } +} diff --git a/src/scenes/gameLoop/day1/livingroomMorningDay1.js b/src/scenes/gameLoop/day1/livingroomMorningDay1.js index dbc5c18..2982111 100644 --- a/src/scenes/gameLoop/day1/livingroomMorningDay1.js +++ b/src/scenes/gameLoop/day1/livingroomMorningDay1.js @@ -10,7 +10,7 @@ export default class LivingroomMorningDay1 extends LivingroomBase { super.create(params); this.bedroom = "BedroomMorningDay1"; - this.playground = "Test"; + this.playground = "PlaygroundMorningDay1"; let tr = { x: 460, @@ -26,11 +26,17 @@ export default class LivingroomMorningDay1 extends LivingroomBase { let nodes = this.cache.json.get('livingroomMorningDay1'); let momNode = super.readNodes("root", nodes, "day1\\livingroomMorningDay1", "mom", true); - - + + if(!this.gameManager.getValue(this.gameManager.bagPicked)) { + this.doorNode = super.readNodes("root", nodes, "day1\\livingroomMorningDay1", "door", true); + } + this.dispatcher.addOnce("setTalked", this, (obj) => { console.log(obj); this.gameManager.setValue("talked", true, this.blackboard); }); + this.dispatcher.add("pickBag", this, (obj) => { + this.doorNode = null; + }); } } diff --git a/src/scenes/gameLoop/day1/playgroundMorningDay1.js b/src/scenes/gameLoop/day1/playgroundMorningDay1.js new file mode 100644 index 0000000..a9a6bea --- /dev/null +++ b/src/scenes/gameLoop/day1/playgroundMorningDay1.js @@ -0,0 +1,30 @@ +import PlaygroundBase from "../playgroundBase.js"; + +export default class PlaygroundMorningDay1 extends PlaygroundBase { + constructor() { + super('PlaygroundMorningDay1'); + } + + create(params) { + super.create(params); + + this.home = "LivingroomMorningDay1"; + this.stairs = "StairsMorningDay1"; + + if (this.gameManager.getValue(this.gameManager.isLate)) { + super.openDoors(); + } + + // TEST + this.bg.setInteractive(); + this.bg.on('pointerdown', () => { + super.openDoors(); + }) + + this.dispatcher.addOnce("openDoors", this, (obj) => { + console.log(obj); + super.openDoors(); + }); + + } +} diff --git a/src/scenes/gameLoop/day1/stairsMorningDay1.js b/src/scenes/gameLoop/day1/stairsMorningDay1.js new file mode 100644 index 0000000..55c1789 --- /dev/null +++ b/src/scenes/gameLoop/day1/stairsMorningDay1.js @@ -0,0 +1,16 @@ +import StairsBase from "../stairsBase.js"; + +export default class StairsMorningDay1 extends StairsBase { + constructor() { + super('StairsMorningDay1'); + } + + create(params) { + super.create(params); + + this.playground = "PlaygroundMorningDay1"; + this.corridor = "CorridorMorningDay1"; + + + } +} diff --git a/src/scenes/gameLoop/livingroomBase.js b/src/scenes/gameLoop/livingroomBase.js index abc7c60..38dfbab 100644 --- a/src/scenes/gameLoop/livingroomBase.js +++ b/src/scenes/gameLoop/livingroomBase.js @@ -3,8 +3,7 @@ import BaseScene from './baseScene.js'; export default class LivingroomBase extends BaseScene { /** - * Escena base para la habitacion. Coloca los elementos comunes a - * la habitacion de todos los dias (cama, puerta, mesa, armarios...) + * Escena base para el salon. Coloca los elementos que se mantienen igual todos los dias * @extends BaseScene * @param {String} name - id de la escena */ @@ -12,19 +11,13 @@ export default class LivingroomBase extends BaseScene { super(name); } - // Metodo que se llama al terminar de crear la escena. - onCreate(params) { - super.onCreate(params); - - this.phoneManager.topLid.visible = false; - this.phoneManager.botLid.visible = false; - } - create(params) { super.create(params); this.bedroom = ""; this.playground = ""; + + this.nextHour = ""; // Pone la imagen de fondo con las dimensiones del canvas let bg = this.add.image(0, 0, 'livingroomBg').setOrigin(0, 0); @@ -34,42 +27,37 @@ export default class LivingroomBase extends BaseScene { this.rightBound = bg.displayWidth; // Puerta a la calle + this.doorNode = null; + this.canExit = false; let playgroundDoorClosed = this.add.image(254 * this.scale - 1, 10 * this.scale - 1, 'living_playDoorClosed').setOrigin(0, 0).setScale(this.scale); let playgroundDoorOpened = this.add.image(254 * this.scale - 1, 10 * this.scale - 1, 'living_playDoorOpened').setOrigin(0, 0).setScale(this.scale); - super.toggleDoor(playgroundDoorClosed, playgroundDoorOpened, false); - - - // Puerta a la habitacion - let bedroomDoorClosed = this.add.image(3958 * this.scale - 5, 175 * this.scale - 2, 'living_bedDoorClosed').setOrigin(0, 0).setScale(this.scale); - let bedroomDoorOpened = this.add.image(3956 * this.scale - 4, 175 * this.scale - 2, 'living_bedDoorOpened').setOrigin(0, 0).setScale(this.scale); - super.toggleDoor(bedroomDoorClosed, bedroomDoorOpened, false); - - - this.playgroundNode = null; - // Al hacer click sobre la puerta a la calle abierta, dependiendo de si se puede salir o - // no, salta un dialogo o pasa a la siguiente escena sin poder regresar a esta escena - playgroundDoorOpened.on('pointerdown', () => { - if (this.playgroundNode) { - this.dialogManager.setNode(this.playgroundNode); + // Al hacer click sobre la puerta abierta, si hay algun dialogo que mostrar (para indicar que no se puede salir), se + // mostrara. En caso contrario, se pasara a la escena del patio con la camara a la izquierda y se eliminara esta escena + super.toggleDoor(playgroundDoorClosed, playgroundDoorOpened, () => { + if (this.doorNode) { + this.dialogManager.setNode(this.doorNode); } else { let params = { - left: true + camPos: "left" }; this.gameManager.changeScene(this.playground, params); } - }); + }, false); - // Al hacer click sobre la puerta a la habitacion abierta, - // se pasa a la habitacion con la camara en la izquierda - bedroomDoorOpened.on('pointerdown', () => { + + // Puerta a la habitacion + let bedroomDoorClosed = this.add.image(3958 * this.scale - 5, 175 * this.scale - 2, 'living_bedDoorClosed').setOrigin(0, 0).setScale(this.scale); + let bedroomDoorOpened = this.add.image(3956 * this.scale - 4, 175 * this.scale - 2, 'living_bedDoorOpened').setOrigin(0, 0).setScale(this.scale); + // Al hacer click sobre la puerta abierta, se pasa a la habitacion con la camara en la izquierda + super.toggleDoor(bedroomDoorClosed, bedroomDoorOpened, () => { let params = { - left: true + camPos: "left" }; this.gameManager.changeScene(this.bedroom, params, true); - }); + }, false); + } - } } diff --git a/src/scenes/gameLoop/nightmareBase.js b/src/scenes/gameLoop/nightmareBase.js new file mode 100644 index 0000000..33490f3 --- /dev/null +++ b/src/scenes/gameLoop/nightmareBase.js @@ -0,0 +1,24 @@ + +import BaseScene from './baseScene.js'; + +export default class NightmareBase extends BaseScene { + /** + * Escena base para los banos. Coloca los elementos que se mantienen igual todos los dias + * @extends BaseScene + * @param {String} name - id de la escena + */ + constructor(name) { + super(name); + } + + create(params) { + super.create(params); + + // Pone la imagen de fondo con las dimensiones del canvas + let bg = this.add.image(0, 0, 'nightmaresBg').setOrigin(0, 0); + this.scale = this.CANVAS_HEIGHT / bg.height; + bg.setScale(this.scale); + + this.rightBound = bg.displayWidth; + } +} \ No newline at end of file diff --git a/src/scenes/gameLoop/playgroundBase.js b/src/scenes/gameLoop/playgroundBase.js new file mode 100644 index 0000000..c3566c0 --- /dev/null +++ b/src/scenes/gameLoop/playgroundBase.js @@ -0,0 +1,72 @@ + +import BaseScene from './baseScene.js'; + +export default class PlaygroundBase extends BaseScene { + /** + * Escena base para el patio. Coloca los elementos que se mantienen igual todos los dias + * @extends BaseScene + * @param {String} name - id de la escena + */ + constructor(name) { + super(name); + } + + create(params) { + super.create(params); + + this.home = ""; + this.stairs = ""; + + this.nextHour = ""; + + // Pone la imagen de fondo con las dimensiones del canvas + this.bgImg = 'playgroundClosed' + this.bg = this.add.image(0, 0, this.bgImg).setOrigin(0, 0); + this.scale = this.CANVAS_HEIGHT / this.bg.height; + this.bg.setScale(this.scale); + this.rightBound = this.bg.displayWidth; + + + this.homeNode = null; + let exit = this.add.rectangle(0, 913 * this.scale, 1140 * this.scale, 490 * this.scale, 0xfff, 0).setOrigin(0, 0); + exit.setInteractive(); + // Al hacer click sobre la zona de salida si hay algun dialogo que mostrar (para indicar que no se puede salir), se + // mostrara. En caso contrario, se pasara a la escena del salon con la camara a la izquierda y se eliminara esta escena + exit.on('pointerdown', () => { + if (this.homeNode) { + this.dialogManager.setNode(this.homeNode); + } + else { + let params = { + camPos: "left" + } + this.gameManager.changeScene(this.home, params); + } + }); + + // Puertas del edificio + this.doorNode = null; + let doors = this.add.rectangle(2640 * this.scale, 1060 * this.scale, 262, 186, 0xfff, 0).setOrigin(0, 0); + doors.setInteractive({ useHandCursor: true }); + // Al hacer click sobre la zona de la peurta, si las puertas estan abiertas, se pasara a la escena de las escaleras + // sin eliminar esta escena. En caso contrario, se mostrara un dialogo indicando que no se puede entrar + doors.on('pointerdown', () => { + // Si las puertas estan abiertas, pasa a la escena de las escaleras + if (this.bgImg === 'playgroundOpened') { + this.gameManager.changeScene(this.stairs, { } , true); + } + // Si no, se muestra el dialogo correspondiente + else { + this.dialogManager.setNode(this.doorNode); + } + }); + + } + + openDoors() { + let bgDepth = this.bg.depth; + this.bgImg = 'playgroundOpened' + this.bg.destroy(); + this.bg = this.add.image(0, 0, this.bgImg).setOrigin(0, 0).setScale(this.scale).setDepth(bgDepth); + } +} \ No newline at end of file diff --git a/src/scenes/gameLoop/stairsBase.js b/src/scenes/gameLoop/stairsBase.js new file mode 100644 index 0000000..65ac9d9 --- /dev/null +++ b/src/scenes/gameLoop/stairsBase.js @@ -0,0 +1,79 @@ + +import BaseScene from './baseScene.js'; + +export default class StairsBase extends BaseScene { + /** + * Escena base para las escaleras. Coloca los elementos que se mantienen igual todos los dias + * @extends BaseScene + * @param {String} name - id de la escena + */ + constructor(name) { + super(name); + } + + create(params) { + super.create(params); + + this.playground = ""; + this.corridor = ""; + + // Pone la imagen de fondo con las dimensiones del canvas + this.bgImg = 'stairsBg' + this.bg = this.add.image(0, 0, this.bgImg).setOrigin(0, 0); + this.scale = this.CANVAS_HEIGHT / this.bg.height; + this.bg.setScale(this.scale); + this.rightBound = this.bg.displayWidth; + + // Puerta del despacho + this.doorNode = null; + let doorPos = { + x: 2490 * this.scale, + y: 273 * this.scale + }; + let doorClosed = this.add.image(doorPos.x, doorPos.y, 'stairsDoorClosed').setOrigin(0, 0).setScale(this.scale); + let doorOpened = this.add.image(doorPos.x, doorPos.y, 'stairsDoorOpened').setOrigin(0, 0).setScale(this.scale); + // Al hacer click en la puerta, se muestra un dialogo + super.toggleDoor(doorClosed, doorOpened, () => { + this.dialogManager.setNode(this.doorNode); + }, false); + + + // Escaleras al patio + this.playgroundNode = null; + let playgroundStairs = this.add.rectangle(379 * this.scale, 711 * this.scale, 980 * this.scale, 600 * this.scale, 0xfff, 0).setOrigin(0, 0); + playgroundStairs.setInteractive({ useHandCursor: true }); + // Al hacer click sobre las escaleras de bajada, si hay algun dialogo que mostrar (para indicar que no se puede bajar), se + // mostrara. En caso contrario, se pasara a la escena del patio con la camara a la derecha sin eliminar esta escena + playgroundStairs.on('pointerdown', () => { + if (this.playgroundNode) { + this.dialogManager.setNode(this.playgroundNode); + } + else { + let params = { + camPos: "right" + }; + this.gameManager.changeScene(this.playground, params, true); + } + }); + + // Escaleras al pasillo + this.corridorNode = null; + let corridorStairs = this.add.rectangle(1110 * this.scale, 60 * this.scale, 800 * this.scale, 770 * this.scale, 0xfff, 0).setOrigin(0, 0); + corridorStairs.setInteractive({ useHandCursor: true }); + // Al hacer click sobre las escaleras de subida, si hay algun dialogo que mostrar (para indicar que no se puede subir), se + // mostrara. En caso contrario, se pasara a la escena del pasillo sin eliminar esta escena + corridorStairs.on('pointerdown', () => { + if (this.corridorNode) { + this.dialogManager.setNode(this.corridorNode); + } + else { + let params = { + camPos: "left" + }; + this.gameManager.changeScene(this.corridor, params, true); + } + }); + + } + +} \ No newline at end of file