Skip to content
This repository has been archived by the owner on Aug 20, 2024. It is now read-only.

Commit

Permalink
1.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
CharlieBodman committed Mar 22, 2019
1 parent f3d8687 commit 76f38f3
Show file tree
Hide file tree
Showing 7 changed files with 50 additions and 9 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@fpcc/fv-game-memory",
"version": "1.0.0",
"version": "1.1.0",
"description": "Memory game for FirstVoices.com",
"main": "scripts/game.js",
"scripts": {
Expand Down
52 changes: 44 additions & 8 deletions scripts/base.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,39 +14,74 @@ class Base
{

}

/**
* Creates mute button control
*/
createMuteButton() {

createMuteButton()
{
const unmuteButton = this.add.sprite(40, 40, 'unmute');
unmuteButton.anchor.setTo(0.5, 0.5);
unmuteButton.scale.setTo(0.3, 0.3);
unmuteButton.inputEnabled = true;
unmuteButton.visible = this.game.sound.mute;
unmuteButton.input.useHandCursor = true;

const muteButton = this.add.sprite(40, 40, 'mute');
muteButton.anchor.setTo(0.5, 0.5);
muteButton.scale.setTo(0.3, 0.3);
muteButton.inputEnabled = true;
muteButton.visible = !this.game.sound.mute;
muteButton.input.useHandCursor = true;

unmuteButton.events.onInputUp.add(()=>{
unmuteButton.events.onInputUp.add(() =>
{
muteButton.visible = true;
unmuteButton.visible = false;
this.game.sound.mute = false;
});

muteButton.events.onInputDown.add(()=>{

muteButton.events.onInputDown.add(() =>
{
unmuteButton.visible = true;
muteButton.visible = false;
this.game.sound.mute = true;
});
}

createFullscreenButton()
{
this.game.scale.fullScreenScaleMode = Phaser.ScaleManager.SHOW_ALL;

const fullscreen = this.add.sprite(this.game.width - 50, 40, 'fullscreen');
fullscreen.anchor.setTo(0.5, 0.5);
fullscreen.scale.setTo(0.3, 0.3);
fullscreen.inputEnabled = true;
fullscreen.visible = !this.game.scale.isFullScreen;
fullscreen.input.useHandCursor = true;

const unfullscreen = this.add.sprite(this.game.width - 50, 40, 'unfullscreen');
unfullscreen.anchor.setTo(0.5, 0.5);
unfullscreen.scale.setTo(0.3, 0.3);
unfullscreen.inputEnabled = true;
unfullscreen.visible = this.game.scale.isFullScreen;
unfullscreen.input.useHandCursor = true;

fullscreen.events.onInputUp.add(() =>
{
unfullscreen.visible = true;
fullscreen.visible = false;
this.game.scale.startFullScreen(false);
});

unfullscreen.events.onInputDown.add(() =>
{
fullscreen.visible = true;
unfullscreen.visible = false;
this.game.scale.stopFullScreen();
});
}

/**
* Creates a "fade in" effect
*/
Expand Down Expand Up @@ -81,7 +116,8 @@ class Base

const backgroundTween = this.game.add.tween(fadeBackground);
backgroundTween.to({ alpha: 1 }, 500, null);
backgroundTween.onComplete.add(()=>{
backgroundTween.onComplete.add(() =>
{
this.game.state.start(state);
}, this);
backgroundTween.start();
Expand Down
2 changes: 2 additions & 0 deletions scripts/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ let defaultGameConfig = {
bubble:'assets/images/bubble.png',
rightArrow:'assets/images/right_arrow.png',
leftArrow:'assets/images/left_arrow.png',
unfullscreen:'assets/images/unfullscreen.png',
fullscreen:'assets/images/fullscreen.png'
},

categories: {
Expand Down
1 change: 1 addition & 0 deletions scripts/menu.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ class Menu extends Base
this.createPrevButton();
this.createTitle();
this.createMuteButton();
this.createFullscreenButton();

this.scrollingMap = this.game.add.tileSprite(0, 240, this.pages.length * this.game.width, this.game.height, "transp");
this.pageText = this.game.add.text(this.game.width / 2, 150, "Select a Category (1 / " + this.pages + ")", { font: "30px Arial", fill: "#FFFFFF" })
Expand Down
2 changes: 2 additions & 0 deletions scripts/preload.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ class Preload extends Base
this.load.image('bubble', config.images.bubble);
this.load.image('rightArrow', config.images.rightArrow);
this.load.image('leftArrow', config.images.leftArrow);
this.load.image('fullscreen', config.images.fullscreen);
this.load.image('unfullscreen', config.images.unfullscreen);

const categories = this.config.categories;

Expand Down
Binary file added www/assets/images/fullscreen.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 www/assets/images/unfullscreen.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 76f38f3

Please sign in to comment.