Skip to content

Issue #37 and #28 fixed #38

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added assets/images/pause.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/images/resume.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 3 additions & 3 deletions js/catchTheFlow.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ function create()

playpause = game.add.sprite(585 , 465 , 'playPause');
playpause.inputEnabled = true;
ppText = game.add.text(480, 495 , ' ' , {font : "15px Arial" , fill : "#eceff1"});
ppText = game.add.text(480, 486 , ' ' , {font : "15px Arial" , fill : "#eceff1"});
ppText.setText('Pause game ');

livingState = game.add.group();
Expand Down Expand Up @@ -290,12 +290,12 @@ function gameOver()

function replayGame()
{
ppText.setText(' ');
ppText.setText('');
playpause.destroy();
playpause = game.add.sprite(585 , 465 , 'playPause');
playpause.inputEnabled = true;
pause = game.input.keyboard.addKey(Phaser.Keyboard.P);
ppText = game.add.text(480, 495 , ' ' , {font : "15px Arial" , fill : "#eceff1"});
//ppText = game.add.text(480, 495 , ' ' , {font : "15px Arial" , fill : "#eceff1"});

pauseState = 1;
pauseAndPlay();
Expand Down
1 change: 1 addition & 0 deletions js/doubleTrouble.js
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,7 @@ function gameOver()

function replayGame()
{
ppText.destroy();
playPause = game.add.sprite(255 , 476 , 'pp_button');
playPause.inputEnabled = true;
playPause.inputEnabled = true;
Expand Down
3 changes: 2 additions & 1 deletion js/migratingFlocks.js
Original file line number Diff line number Diff line change
Expand Up @@ -296,10 +296,11 @@ function gameOver()
function replayGame()
{
playpause.destroy();
ppText.setText('');
playpause = game.add.sprite(595 , 475 , 'playPause');
playpause.inputEnabled = true;
pause = game.input.keyboard.addKey(Phaser.Keyboard.P);
ppText = game.add.text(460, 485 , ' ' , {font : "15px Arial" , fill : "#eceff1"});
//ppText = game.add.text(460, 485 , ' ' , {font : "15px Arial" , fill : "#eceff1"});

pauseState = 1;
pauseAndPlay();
Expand Down
88 changes: 60 additions & 28 deletions js/mindMath.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,9 @@ function preload() {
game.load.image('living', 'assets/images/highClick/living_30_30.png');
game.load.image('dead', 'assets/images/highClick/dead_30_30.png');
game.load.image('start_screen' , 'assets/images/startScreen_640_520.jpg');
game.load.image('start_button' , 'assets/images/start_50_50.png');
game.load.image('pause', 'assets/images/highClick/pause_30_30.png');
game.load.image('start_button' , 'assets/images/start.gif');
game.load.image('resume_button' , 'assets/images/resume.png');
game.load.image('pause', 'assets/images/pause.png');
game.load.image('questionBox', 'assets/images/mindMath/questionBox_100_100.png');
game.load.image('answerBox', 'assets/images/mindMath/answerBox_300_75.png');
game.load.image('replay' , 'assets/images/replay_100_100.png');
Expand All @@ -31,7 +32,6 @@ var score = 0;
var lifeline = 3;
var play;
var pause;
var tempText;
var mylevel;
var myscore;
var questionBox;
Expand All @@ -47,12 +47,14 @@ var instructionText;
function create() {
game.add.sprite(0, 0, 'background');
livingState = game.add.group();

for (var p = 0; p < 3; p++) {
life = livingState.create(27, 180 + p * 38, 'living');
}
tempText = game.add.text(470, 470, ' ', { font: "15px Arial", fill: "#eceff1" });
pause = game.add.sprite(575, 455, 'pause');
pause = game.add.sprite(556, 438, 'pause');
pause.scale.setTo(0.37,0.37);
pause.inputEnabled = true;

myscore = game.add.text(80, 43, '000', { font: "15px Arial", fill: "#eceff1" });
mylevel = game.add.text(311, 43, '01', { font: "15px Arial", fill: "#eceff1" });
timer = game.add.text(515, 43, '00:00:00', { font: "15px Arial", fill: "#eceff1" });
Expand Down Expand Up @@ -131,6 +133,7 @@ function update() {
updateTimer();
updateBox();
pause.events.onInputDown.add(pauseAndPlay);
game.input.onDown.add(unpause, self);

//console.log(questionBoxActive[0]);
//console.log(questionBox.getAt(questionBoxActive[0]).inputEnabled);
Expand Down Expand Up @@ -498,11 +501,18 @@ function gameOver()
function replayGame()
{
pause.destroy();
pause = game.add.sprite(575,455,'pause');
pause = game.add.sprite(556, 438, 'pause');
pause.scale.setTo(0.37,0.37);
pause.inputEnabled = true;
tempText = game.add.text(470, 470 , ' ' , {font : "15px Arial" , fill : "#eceff1"});
pauseState = 1;
pauseAndPlay();
for (var i = 0; i < 9; i++) {
//questionBox.getAt(i).alpha = 1;
questionText[i].alpha = 1;
}
for(i = 0; i<4; i++)
{
answerText[i].alpha =1;
}
makeQuestion();
score = 0;
displayScore = 0;
myscore.setText('000');
Expand Down Expand Up @@ -587,7 +597,7 @@ var timeText;
function updateTimer() {
if (startGame === 1) {
//To find and display the elapsed time.
if (pauseState === 0) {
if (!game.paused) {
if (timeUpdateFlag === 0) {
timeUpdateFlag = 1;
timePaused = timePaused + (Math.floor(game.time.totalElapsedSeconds()) - totalSeconds);
Expand Down Expand Up @@ -624,22 +634,35 @@ function updateTimer() {
var finishFlag = 0;

function pauseAndPlay() {
if (pauseState === 0) {
pauseState = 1;
tempText.setText('Game Paused');
for (var i = 0; i < 9; i++) {
//questionBox.getAt(i).alpha = 0;
questionText[i].alpha = 0;
}
for(i = 0; i<4; i++)
{
answerText[i].alpha =0;
}
gamePhase = 0;
}
else {
tempText.setText(' ');
for (var i = 0; i < 9; i++) {
game.paused=true;
resume = game.add.sprite(640/2, 520/2, 'resume_button');
resume.scale.setTo(0.4,0.4);
resume.anchor.setTo(0.5, 0.5);
pause.destroy();
for (var i = 0; i < 9; i++) {
//questionBox.getAt(i).alpha = 0;
questionText[i].alpha = 0;
}
for(i = 0; i<4; i++)
{
answerText[i].alpha =0;
}
gamePhase = 0;



}

function unpause(event) {
if (game.paused) {

var x1 = 640/2-resume.width/2, x2 = 640/2+resume.width/2,
y1 = 520/2-resume.height/2, y2 = 520/2+resume.height/2;

if(event.x > x1 && event.x < x2 && event.y > y1 && event.y < y2 ){


for (var i = 0; i < 9; i++) {
//questionBox.getAt(i).alpha = 1;
questionText[i].alpha = 1;
}
Expand All @@ -648,9 +671,18 @@ function pauseAndPlay() {
answerText[i].alpha =1;
}
makeQuestion();
pauseState = 0;
}
game.paused=false;
resume.destroy();
pause = game.add.sprite(556, 438, 'pause');
pause.scale.setTo(0.37,0.37);
pause.inputEnabled = true;

}

}

}

function finishGame()
{
gameOver();
Expand Down
7 changes: 4 additions & 3 deletions js/motionCommotion.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ function create()
playpause.scale.setTo(0.7,0.7);
playpause.inputEnabled = true;

ppText = game.add.text(480, 495 , ' ' , {font : "15px Arial" , fill : "#0097a7"});
ppText = game.add.text(480, 490 , ' ' , {font : "15px Arial" , fill : "#0097a7"});
ppText.setText('Pause game ');

timer = game.add.text(538, 19, '00:00:00' ,{font : "18px Arial" , fill : "#0097a7"});
Expand Down Expand Up @@ -318,12 +318,13 @@ function gameOver()

function replayGame()
{
ppText.setText(' ');
ppText.setText('');
playpause.destroy();
playpause = game.add.sprite(585 , 465 , 'playPause');
playpause.scale.setTo(0.7,0.7);
playpause.inputEnabled = true;
pause = game.input.keyboard.addKey(Phaser.Keyboard.P);
ppText = game.add.text(480, 495 , ' ' , {font : "15px Arial" , fill : "#eceff1"});
//ppText = game.add.text(480, 490 , ' ' , {font : "15px Arial" , fill : "#eceff1"});

pauseState = 1;
pauseAndPlay();
Expand Down