diff --git a/accountEqn.js b/accountEqn.js index 4d59a1b..3058525 100755 --- a/accountEqn.js +++ b/accountEqn.js @@ -13,7 +13,6 @@ class accountEqn extends Phaser.Scene { this.room3_activityFiveOpened = false; this.room3_helpOpen = false; this.room3_counter = 0; - this.musicToggle = false; document.getElementById("background").volume = 0.8; } //load assets in preload() @@ -48,13 +47,13 @@ class accountEqn extends Phaser.Scene { if (Phaser.Input.Keyboard.JustDown(this.room3_key_N)) { document.getElementById("background").play(); - if (this.musicToggle == false) { + if (musicToggle == false) { document.getElementById("background").play(); - this.musicToggle = true; + musicToggle = true; } - else if (this.musicToggle == true) { + else if (musicToggle == true) { document.getElementById("background").pause(); - this.musicToggle = false; + musicToggle = false; } } diff --git a/assets/MTOffTransparent.png b/assets/MTOffTransparent.png new file mode 100644 index 0000000..b8bea95 Binary files /dev/null and b/assets/MTOffTransparent.png differ diff --git a/assets/MTOnTransparent.png b/assets/MTOnTransparent.png new file mode 100644 index 0000000..de2b558 Binary files /dev/null and b/assets/MTOnTransparent.png differ diff --git a/bbActRoom.js b/bbActRoom.js index 5361d36..adb26eb 100644 --- a/bbActRoom.js +++ b/bbActRoom.js @@ -6,7 +6,6 @@ class bbActRoom extends Phaser.Scene { super("BB_ActRoom"); this.room2a_helpOpen = false; this.room2a_characterMoveable = true; - this.musicToggle = false; } //load assets in preload() @@ -42,14 +41,15 @@ class bbActRoom extends Phaser.Scene { if (Phaser.Input.Keyboard.JustDown(this.room2a_key_N)) { document.getElementById("background").play(); - if (this.musicToggle == false) { + if (musicToggle == false) { document.getElementById("background").play(); - this.musicToggle = true; + musicToggle = true; } - else if (this.musicToggle == true) { + else if (musicToggle == true) { document.getElementById("background").pause(); - this.musicToggle = false; + musicToggle = false; } + this.musicToggled(); } @@ -129,6 +129,8 @@ class bbActRoom extends Phaser.Scene { // this.load.image('room2a_puzzle1', 'assets/Room2Act1/Puzzle/Puzzle/Puzzle1A.png'); this.load.image('room2a_parents', 'assets/Room2Act2/couple.png'); this.load.image('singleCoin', 'assets/Coin/singleCoin.png'); + this.load.image('MTOn', 'assets/MTOnTransparent.png'); + this.load.image('MTOff', 'assets/MTOffTransparent.png'); } /* createImages @@ -155,6 +157,8 @@ class bbActRoom extends Phaser.Scene { // this.room2a_puzzle1 = this.add.image(1168, 400, 'room2a_puzzle1'); this.room2a_parents = this.add.image(868, 611, 'room2a_parents'); this.countCoin = this.add.image(40, 150, 'singleCoin'); + this.MTOn = this.add.image(50, 750, 'MTOn'); + this.MTOff = this.add.image(50, 750, 'MTOff'); } /* setAlphas @@ -174,7 +178,14 @@ class bbActRoom extends Phaser.Scene { this.countCoin.alpha = 0.0; this.coin0.alpha = 1.0; this.coinHead.alpha = 0.0; - + if (musicToggle == false) { + this.MTOff.alpha = 1.0; + this.MTOn.alpha = 0.0; + } + if (musicToggle == true) { + this.MTOn.alpha = 1.0; + this.MTOff.alpha = 0.0; + } } /* setDepths @@ -192,6 +203,8 @@ class bbActRoom extends Phaser.Scene { this.room2a_notebook.setDepth(100); this.room2a_help_menu.setDepth(100); this.countCoin.setDepth(0); + this.MTOn.setDepth(0); + this.MTOff.setDepth(0); } /* setScales @@ -215,6 +228,8 @@ class bbActRoom extends Phaser.Scene { this.countCoin.setScale(0.25); this.coin0.setScale(0.5); this.coinHead.setScale(0.5); + this.MTOn.setScale(0.2); + this.MTOff.setScale(0.2); } /* setRotations @@ -548,6 +563,17 @@ class bbActRoom extends Phaser.Scene { this.count.setText('x ' + coinCount); } + musicToggled() { + if (musicToggle == false) { + this.MTOn.alpha = 0.0; + this.MTOff.alpha = 1.0; + } + else if (musicToggle == true) { + this.MTOff.alpha = 0.0; + this.MTOn.alpha = 1.0; + } + } + /* helpMenu * * Sets the alpha of the help menu to 1 so that it is visible diff --git a/buildBlockAct0.js b/buildBlockAct0.js index ccc021b..18071ed 100755 --- a/buildBlockAct0.js +++ b/buildBlockAct0.js @@ -10,7 +10,6 @@ class buildBlockAct0 extends Phaser.Scene { this.paperCount = 1; this.maxPaper = 3; this.counter = 0; - this.musicToggle = false; document.getElementById("background").volume = 0.8; } //load assets in preload() @@ -49,14 +48,15 @@ class buildBlockAct0 extends Phaser.Scene { if (Phaser.Input.Keyboard.JustDown(this.key_N)) { document.getElementById("background").play(); - if (this.musicToggle == false) { + if (musicToggle == false) { document.getElementById("background").play(); - this.musicToggle = true; + musicToggle = true; } - else if (this.musicToggle == true) { + else if (musicToggle == true) { document.getElementById("background").pause(); - this.musicToggle = false; + musicToggle = false; } + this.musicToggled(); } if (roomProgress <= 2200) { @@ -217,6 +217,8 @@ class buildBlockAct0 extends Phaser.Scene { this.load.image('balanceSheet', 'assets/Documents/balanceSheet.png'); this.load.image('retainedEarnings' , 'assets/Documents/retainedEarnings.png'); this.load.image('singleCoin', 'assets/Coin/singleCoin.png'); + this.load.image('MTOn', 'assets/MTOnTransparent.png'); + this.load.image('MTOff', 'assets/MTOffTransparent.png'); } /* createImages @@ -251,6 +253,8 @@ class buildBlockAct0 extends Phaser.Scene { this.balanceSheet = this.add.image(768, 432, 'balanceSheet'); this.retainedEarnings = this.add.image(768, 432, 'retainedEarnings'); this.countCoin = this.add.image(40, 150, 'singleCoin'); + this.MTOn = this.add.image(50, 750, 'MTOn'); + this.MTOff = this.add.image(50, 750, 'MTOff'); } /* setAlphas @@ -266,22 +270,30 @@ class buildBlockAct0 extends Phaser.Scene { this.help_menu.alpha = 0.0; this.r2a0_walls.alpha = 1; this.r2a0_floor.alpha = 1; - this.returnDoor.alpha = 1; - // FinStmt sorting activity w/ boxes is not in room1 anymore... - this.SreBox.alpha = 1; - this.ScfBox.alpha = 1; - this.BalShtBox.alpha = 1; - this.IncStmBox.alpha = 1; - this.paper.alpha = 1; - // this.paper_stack.alpha = 1; - - this.wall_info_2.alpha = 1; + this.returnDoor.alpha = 1; + // FinStmt sorting activity w/ boxes is not in room1 anymore... + this.SreBox.alpha = 1; + this.ScfBox.alpha = 1; + this.BalShtBox.alpha = 1; + this.IncStmBox.alpha = 1; + this.paper.alpha = 1; + // this.paper_stack.alpha = 1; + + this.wall_info_2.alpha = 1; this.incomeStatement.alpha = 0; this.balanceSheet.alpha = 0; this.retainedEarnings.alpha = 0; //this.coin0.alpha = 0.0; this.coinHead.alpha = 0.0; this.countCoin.alpha = 1.0; + if (musicToggle == false) { + this.MTOff.alpha = 1.0; + this.MTOn.alpha = 0.0; + } + if (musicToggle == true) { + this.MTOn.alpha = 1.0; + this.MTOff.alpha = 0.0; + } } /* setDepths @@ -313,6 +325,8 @@ class buildBlockAct0 extends Phaser.Scene { this.BalShtBox.setDepth(2); this.returnDoor.setDepth(2); this.countCoin.setDepth(0); + this.MTOn.setDepth(0); + this.MTOff.setDepth(0); } /* setScales @@ -340,6 +354,8 @@ class buildBlockAct0 extends Phaser.Scene { //this.coin0.setScale(0.5); this.coinHead.setScale(0.5); this.countCoin.setScale(0.25); + this.MTOn.setScale(0.2); + this.MTOff.setScale(0.2); } /* setRotations @@ -670,6 +686,17 @@ class buildBlockAct0 extends Phaser.Scene { this.count.setText('x ' + coinCount); } + musicToggled() { + if (musicToggle == false) { + this.MTOn.alpha = 0.0; + this.MTOff.alpha = 1.0; + } + else if (musicToggle == true) { + this.MTOff.alpha = 0.0; + this.MTOn.alpha = 1.0; + } + } + /* helpMenu * * Sets the alpha of the help menu to 1 so that it is visible diff --git a/buildBlockAct2.js b/buildBlockAct2.js index 52b9a4e..5cfc3b5 100644 --- a/buildBlockAct2.js +++ b/buildBlockAct2.js @@ -7,7 +7,6 @@ class buildBlockAct2 extends Phaser.Scene { this.room2b_unlocked = false; this.room2b_helpOpen = false; this.room2b_count = 1; - this.musicToggle = false; } //load assets in preload() @@ -42,13 +41,13 @@ class buildBlockAct2 extends Phaser.Scene { if (Phaser.Input.Keyboard.JustDown(this.room2b_key_N)) { document.getElementById("background").play(); - if (this.musicToggle == false) { + if (musicToggle == false) { document.getElementById("background").play(); - this.musicToggle = true; + musicToggle = true; } - else if (this.musicToggle == true) { + else if (musicToggle == true) { document.getElementById("background").pause(); - this.musicToggle = false; + musicToggle = false; } } @@ -279,6 +278,8 @@ class buildBlockAct2 extends Phaser.Scene { // this.load.image('cashFlows' , 'assets/Documents/cashFlows.jpg'); // this.load.image('room2b_hole', 'assets/hole.png'); this.load.image('singleCoin', 'assets/Coin/singleCoin.png'); + this.load.image('MTOn', 'assets/MTOnTransparent.png'); + this.load.image('MTOff', 'assets/MTOffTransparent.png'); } /* createImages @@ -332,6 +333,8 @@ class buildBlockAct2 extends Phaser.Scene { this.questionStack = this.add.image(100, 100, 'questionStack'); // this.room2b_hole = this.add.image(268, 432, 'room2b_hole'); this.countCoin = this.add.image(40, 150, 'singleCoin'); + this.MTOn = this.add.image(50, 750, 'MTOn'); + this.MTOff = this.add.image(50, 750, 'MTOff'); } /* setAlphas @@ -375,6 +378,14 @@ class buildBlockAct2 extends Phaser.Scene { this.coin0.alpha = 0.0; this.hideActivities(); this.countCoin.alpha = 0.0; + if (musicToggle == false) { + this.MTOn.alpha = 0.0; + this.MTOff.alpha = 1.0; + } + if (musicToggle == true) { + this.MTOff.alpha = 0.0; + this.MTOn.alpha = 1.0; + } } /* setDepths @@ -422,6 +433,8 @@ class buildBlockAct2 extends Phaser.Scene { this.r2a2_q3_incstmW.setDepth(100); this.r2a2_congrats.setDepth(100); this.countCoin.setDepth(0); + this.MTOn.setDepth(0); + this.MTOff.setDepth(0); } /* setScales @@ -455,6 +468,8 @@ class buildBlockAct2 extends Phaser.Scene { this.coinHead.setScale(0.5); this.coin0.setScale(0.5); this.countCoin.setScale(0.25); + this.MTOn.setScale(0.2); + this.MTOff.setScale(0.2); } /* setRotations @@ -1219,6 +1234,17 @@ class buildBlockAct2 extends Phaser.Scene { } */ + musicToggled() { + if (musicToggle == false) { + this.MTOn.alpha = 0.0; + this.MTOff.alpha = 1.0; + } + else if (musicToggle == true) { + this.MTOff.alpha = 0.0; + this.MTOn.alpha = 1.0; + } + } + /* helpMenu * diff --git a/buildingBlocks.js b/buildingBlocks.js index 808e820..d1a05bf 100755 --- a/buildingBlocks.js +++ b/buildingBlocks.js @@ -13,7 +13,6 @@ class buildingBlocks extends Phaser.Scene { this.room2_activitySixOpened = false; this.room2_helpOpen = false; this.counter = 0; - this.musicToggle = false; document.getElementById("background").volume = 0.8; } @@ -52,14 +51,15 @@ class buildingBlocks extends Phaser.Scene { if (Phaser.Input.Keyboard.JustDown(this.room2_key_N)) { document.getElementById("background").play(); - if (this.musicToggle == false) { + if (musicToggle == false) { document.getElementById("background").play(); - this.musicToggle = true; + musicToggle = true; } - else if (this.musicToggle == true) { + else if (musicToggle == true) { document.getElementById("background").pause(); - this.musicToggle = false; + musicToggle = false; } + this.musicToggled(); } if (Phaser.Input.Keyboard.JustDown(this.room2_key_H)) { @@ -223,6 +223,8 @@ class buildingBlocks extends Phaser.Scene { this.load.image('rightArrow' , 'assets/rightArrowTest.png'); this.load.image('returnDoor', 'assets/dooropen_100x100.png'); this.load.image('singleCoin', 'assets/Coin/singleCoin.png'); + this.load.image('MTOn', 'assets/MTOnTransparent.png'); + this.load.image('MTOff', 'assets/MTOffTransparent.png'); } /* createImages @@ -281,6 +283,8 @@ class buildingBlocks extends Phaser.Scene { this.rightArrow = this.add.image(1000, 650, 'rightArrow'); this.leftArrow = this.add.image(600, 650, 'rightArrow'); this.countCoin = this.add.image(40, 150, 'singleCoin'); + this.MTOn = this.add.image(50, 750, 'MTOn'); + this.MTOff = this.add.image(50, 750, 'MTOff'); } /* setAlphas @@ -302,6 +306,14 @@ class buildingBlocks extends Phaser.Scene { this.countCoin.alpha = 0.0; this.coin0.alpha = 0.0; this.coinHead.alpha = 0.0; + if (musicToggle == false) { + this.MTOff.alpha = 1.0; + this.MTOn.alpha = 0.0; + } + if (musicToggle == true) { + this.MTOn.alpha = 1.0; + this.MTOff.alpha = 0.0; + } } /* setDepths @@ -346,7 +358,8 @@ class buildingBlocks extends Phaser.Scene { this.room2_help_menu.setDepth(100); this.countCoin.setDepth(0); this.returnDoor.setDepth(1); - + this.MTOn.setDepth(0); + this.MTOff.setDepth(0); } /* setScales @@ -391,6 +404,8 @@ class buildingBlocks extends Phaser.Scene { this.countCoin.setScale(0.25); this.coin0.setScale(0.5); this.coinHead.setScale(0.5); + this.MTOn.setScale(0.2); + this.MTOff.setScale(0.2); } /* setRotations @@ -1187,6 +1202,17 @@ class buildingBlocks extends Phaser.Scene { this.count.setText('x ' + coinCount); } + musicToggled() { + if (musicToggle == false) { + this.MTOn.alpha = 0.0; + this.MTOff.alpha = 1.0; + } + else if (musicToggle == true) { + this.MTOff.alpha = 0.0; + this.MTOn.alpha = 1.0; + } + } + /* helpMenu * * Sets the alpha of the help menu to 1 so that it is visible diff --git a/courseIntro.js b/courseIntro.js index e317990..8937a6e 100755 --- a/courseIntro.js +++ b/courseIntro.js @@ -9,7 +9,6 @@ class courseIntro extends Phaser.Scene { this.helpOpen = false; this.holeOpened = false; this.counter = 0; - this.musicToggle = false; document.getElementById("background").volume = 0.8; } //load assets in preload() @@ -45,14 +44,15 @@ class courseIntro extends Phaser.Scene { if (Phaser.Input.Keyboard.JustDown(this.key_N)) { document.getElementById("background").play(); - if (this.musicToggle == false) { + if (musicToggle == false) { document.getElementById("background").play(); - this.musicToggle = true; + musicToggle = true; } - else if (this.musicToggle == true) { + else if (musicToggle == true) { document.getElementById("background").pause(); - this.musicToggle = false; + musicToggle = false; } + this.musicToggled(); } if (this.activityOneOpened) { @@ -241,6 +241,8 @@ class courseIntro extends Phaser.Scene { this.load.image('leftArrow' , 'assets/leftArrow.png'); this.load.image('rightArrow' , 'assets/rightArrowTest.png'); this.load.image('singleCoin', 'assets/Coin/singleCoin.png'); + this.load.image('MTOn', 'assets/MTOnTransparent.png'); + this.load.image('MTOff', 'assets/MTOffTransparent.png'); } /* createImages @@ -294,6 +296,8 @@ class courseIntro extends Phaser.Scene { //this.placements0.setVisible(false); //this.placements1.setVisible(false); //this.placements2.setVisible(false); + this.MTOn = this.add.image(50, 750, 'MTOn'); + this.MTOff = this.add.image(50, 750, 'MTOff'); } /* setAlphas @@ -320,6 +324,14 @@ class courseIntro extends Phaser.Scene { //this.cardboard_box_2.alpha = 0; //this.cardboard_box_3.alpha = 0; //this.paper_stack.alpha = 0; + if (musicToggle == false) { + this.MTOff.alpha = 1.0; + this.MTOn.alpha = 0.0; + } + if (musicToggle == true) { + this.MTOn.alpha = 1.0; + this.MTOff.alpha = 0.0; + } } /* setDepths @@ -351,6 +363,8 @@ class courseIntro extends Phaser.Scene { this.hole.setDepth(1); this.returnDoor.setDepth(1); this.countCoin.setDepth(0); + this.MTOn.setDepth(0); + this.MTOff.setDepth(0); } /* setScales @@ -393,6 +407,8 @@ class courseIntro extends Phaser.Scene { this.coin0.setScale(0.5); this.coinHead.setScale(0.5); this.countCoin.setScale(0.25); + this.MTOn.setScale(0.2); + this.MTOff.setScale(0.2); } /* setRotations @@ -1316,6 +1332,17 @@ class courseIntro extends Phaser.Scene { this.count.setText('x ' + coinCount); } + musicToggled() { + if (musicToggle == false) { + this.MTOn.alpha = 0.0; + this.MTOff.alpha = 1.0; + } + else if (musicToggle == true) { + this.MTOff.alpha = 0.0; + this.MTOn.alpha = 1.0; + } + } + /* helpMenu * * Sets the alpha of the help menu to 1 so that it is visible diff --git a/main.js b/main.js index 52e01fb..a1c10f2 100644 --- a/main.js +++ b/main.js @@ -22,3 +22,4 @@ var wallAlpha = 0.5; var musicToggle = false; var game = new Phaser.Game(config); var coinCount = 0; +var musicToggle = false; diff --git a/tagIntro.js b/tagIntro.js index e55c950..e9ac312 100644 --- a/tagIntro.js +++ b/tagIntro.js @@ -9,7 +9,6 @@ class tagIntro extends Phaser.Scene { this.paperMoveable = false; this.activityOneOpened = false; this.helpOpen = false; - this.musicToggle = false; } //load assets in preload() @@ -51,14 +50,15 @@ Info Panels like these contain important information and lessons that help you p if (Phaser.Input.Keyboard.JustDown(this.key_N)) { document.getElementById("background").play(); - if (this.musicToggle == false) { + if (musicToggle == false) { document.getElementById("background").play(); - this.musicToggle = true; + musicToggle = true; } - else if (this.musicToggle == true) { + else if (musicToggle == true) { document.getElementById("background").pause(); - this.musicToggle = false; + musicToggle = false; } + this.musicToggled(); } @@ -170,6 +170,8 @@ Info Panels like these contain important information and lessons that help you p this.load.image('featNotAvail', 'assets/featNotAvail.png'); this.load.image('coinExplain', 'assets/Coin/coinExplain.png'); this.load.image('singleCoin', 'assets/Coin/singleCoin.png'); + this.load.image('MTOn', 'assets/MTOnTransparent.png'); + this.load.image('MTOff', 'assets/MTOffTransparent.png'); } createImages() { @@ -192,7 +194,8 @@ Info Panels like these contain important information and lessons that help you p this.hole = this.add.image(768, 432, 'hole'); this.coinExplain = this.add.image(768, 432, 'coinExplain'); this.countCoin = this.add.image(40, 150, 'singleCoin'); - + this.MTOn = this.add.image(50, 750, 'MTOn'); + this.MTOff = this.add.image(50, 750, 'MTOff'); } setAlphas() { @@ -213,6 +216,14 @@ Info Panels like these contain important information and lessons that help you p this.coinExplain.alpha = 0.0; this.hideActivities(); this.countCoin.alpha = 0.0; + if (musicToggle == false) { + this.MTOff.alpha = 1.0; + this.MTOn.alpha = 0.0; + } + if (musicToggle == true) { + this.MTOn.alpha = 1.0; + this.MTOff.alpha = 0.0; + } } setDepths() { @@ -231,6 +242,8 @@ Info Panels like these contain important information and lessons that help you p this.hole.setDepth(1); this.coinExplain.setDepth(2); this.countCoin.setDepth(0); + this.MTOn.setDepth(0); + this.MTOff.setDepth(0); } setScales() { @@ -248,6 +261,8 @@ Info Panels like these contain important information and lessons that help you p this.coinHead.setScale(0.5); this.coinExplain.setScale(2.0); this.countCoin.setScale(0.25); + this.MTOn.setScale(0.2); + this.MTOff.setScale(0.2); } setRotations() { @@ -323,6 +338,8 @@ Info Panels like these contain important information and lessons that help you p if(roomProgress < 1000) roomProgress = 1000; document.getElementById("background").play(); + musicToggle = true; + this.scene.start("Course_Intro"); } @@ -657,6 +674,18 @@ Info Panels like these contain important information and lessons that help you p this.count.setText('x ' + coinCount); } + //@author: Zoe U. + musicToggled() { + if (musicToggle == false) { + this.MTOn.alpha = 0.0; + this.MTOff.alpha = 1.0; + } + else if (musicToggle == true) { + this.MTOff.alpha = 0.0; + this.MTOn.alpha = 1.0; + } + } + helpMenu() { this.help_menu.alpha = 1.0; this.helpOpen = true;