This repository has been archived by the owner on Aug 20, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit b1111dd
Showing
36 changed files
with
4,695 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
# Logs | ||
logs | ||
*.log | ||
npm-debug.log* | ||
yarn-debug.log* | ||
yarn-error.log* | ||
|
||
# Runtime data | ||
pids | ||
*.pid | ||
*.seed | ||
*.pid.lock | ||
|
||
# Directory for instrumented libs generated by jscoverage/JSCover | ||
lib-cov | ||
|
||
# Coverage directory used by tools like istanbul | ||
coverage | ||
|
||
# nyc test coverage | ||
.nyc_output | ||
|
||
# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) | ||
.grunt | ||
|
||
# Bower dependency directory (https://bower.io/) | ||
bower_components | ||
|
||
# node-waf configuration | ||
.lock-wscript | ||
|
||
# Compiled binary addons (https://nodejs.org/api/addons.html) | ||
build/Release | ||
|
||
# Dependency directories | ||
node_modules/ | ||
jspm_packages/ | ||
|
||
# TypeScript v1 declaration files | ||
typings/ | ||
|
||
# Optional npm cache directory | ||
.npm | ||
|
||
# Optional eslint cache | ||
.eslintcache | ||
|
||
# Optional REPL history | ||
.node_repl_history | ||
|
||
# Output of 'npm pack' | ||
*.tgz | ||
|
||
# Yarn Integrity file | ||
.yarn-integrity | ||
|
||
# dotenv environment variables file | ||
.env | ||
|
||
# next.js build output | ||
.next.DS_Store | ||
|
||
.DS_Store |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
#First Voices Word Search |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
import Memory from './scripts/game'; | ||
|
||
document.addEventListener("DOMContentLoaded", function(event) { | ||
const gameContainer = document.getElementById('game'); | ||
Memory.init(gameContainer,{}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
{ | ||
"name": "fv-game-memory", | ||
"version": "1.0.0", | ||
"description": "", | ||
"main": "scripts/game.js", | ||
"scripts": { | ||
"develop": "webpack-dev-server --config webpack.config.js --progress --colors --content-base www/", | ||
"test": "echo \"Error: no test specified\" && exit 1" | ||
}, | ||
"keywords": [], | ||
"author": "", | ||
"license": "ISC", | ||
"devDependencies": { | ||
"@babel/core": "^7.2.2", | ||
"babel-loader": "^8.0.5", | ||
"css-loader": "^2.1.0", | ||
"html-webpack-plugin": "^3.2.0", | ||
"style-loader": "^0.23.1", | ||
"webpack-cli": "^3.2.1", | ||
"webpack-dev-server": "^3.1.14" | ||
}, | ||
"dependencies": { | ||
"expose-loader": "^0.7.5", | ||
"global": "^4.3.1", | ||
"lodash": "^4.17.2", | ||
"merge-stream": "^1.0.1", | ||
"phaser-ce": "^2.7.2", | ||
"require-dir": "^0.3.1", | ||
"webpack": "^4.28.4" | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import configManager from './config'; | ||
|
||
class Boot { | ||
|
||
init() { | ||
this.config = configManager.getConfig(); | ||
this.game.stage.backgroundColor = "#FFFFFF"; | ||
} | ||
|
||
preload() { | ||
this.game.load.image('loading', this.config.images.preloaderLoading); | ||
this.game.load.image('brand', this.config.images.preloaderLogo); | ||
} | ||
|
||
startPreloadScene() { | ||
this.game.state.start("Preload"); | ||
} | ||
|
||
create() { | ||
this.scale.scaleMode = Phaser.ScaleManager.SHOW_ALL; | ||
setTimeout(this.startPreloadScene.bind(this), 500); | ||
} | ||
} | ||
|
||
export default Boot; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
let defaultGameConfig = { | ||
|
||
images:{ | ||
preloaderLoading:'assets/images/loading.png', | ||
preloaderLogo:'assets/images/logo.png', | ||
background:'assets/images/background.png', | ||
card:'assets/images/card.png', | ||
cardFlipped:'assets/images/card_flipped.png', | ||
title:'assets/images/title.png', | ||
time:'assets/images/time.png', | ||
wellDone:'assets/images/well-done.png' | ||
}, | ||
|
||
cards:[ | ||
{ | ||
word:'Word 1', | ||
translation:'english translation long sentence', | ||
image:'assets/images/example/1.png', | ||
audio:'assets/sounds/sample.mp3' | ||
}, | ||
{ | ||
word:'Word 2', | ||
translation:'english translation', | ||
image:'assets/images/example/2.png', | ||
audio:'assets/sounds/sample.mp3' | ||
}, | ||
{ | ||
word:'Word 3', | ||
translation:'english translation', | ||
image:'assets/images/example/3.png', | ||
audio:'assets/sounds/sample.mp3' | ||
}, | ||
{ | ||
word:'Word 4', | ||
translation:'english translation', | ||
image:'assets/images/example/4.png', | ||
audio:'assets/sounds/sample.mp3' | ||
}, | ||
{ | ||
word:'Word 5', | ||
translation:'english translation', | ||
image:'assets/images/example/5.png', | ||
audio:'assets/sounds/sample.mp3' | ||
}, | ||
{ | ||
word:'Word 6', | ||
translation:'english translation', | ||
image:'assets/images/example/1.png', | ||
audio:'assets/sounds/sample.mp3' | ||
}, | ||
{ | ||
word:'Word 7', | ||
translation:'english translation', | ||
image:'assets/images/example/2.png', | ||
audio:'assets/sounds/sample.mp3' | ||
}, | ||
{ | ||
word:'Word 8', | ||
translation:'english translation', | ||
image:'assets/images/example/3.png', | ||
audio:'assets/sounds/sample.mp3' | ||
}, | ||
{ | ||
word:'Word 9', | ||
translation:'english translation', | ||
image:'assets/images/example/4.png', | ||
audio:'assets/sounds/sample.mp3' | ||
}, | ||
{ | ||
word:'Word 10', | ||
translation:'english translation', | ||
image:'assets/images/example/5.png', | ||
audio:'assets/sounds/sample.mp3' | ||
} | ||
] | ||
|
||
}; | ||
|
||
let gameConfig = {}; | ||
|
||
export default { | ||
|
||
setConfig:(config) => { | ||
gameConfig = Object.assign({}, defaultGameConfig, config, gameConfig); | ||
}, | ||
|
||
reset:() => { | ||
gameConfig = {}; | ||
}, | ||
|
||
getConfig:() => { | ||
return gameConfig; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
//Scenes | ||
import Boot from './boot'; | ||
import Preload from './preload'; | ||
import GameTitle from './gametitle'; | ||
import Main from './main'; | ||
import GameOver from './gameover'; | ||
import GameConfig from './config'; | ||
|
||
/** | ||
* Memory Game | ||
*/ | ||
class Game { | ||
|
||
/** | ||
* Initialize the game | ||
* @param {HtmlElement} containerElement | ||
* @param {object} config | ||
*/ | ||
init(containerElement, config) { | ||
this.destroy(); | ||
|
||
//Set Game Config | ||
GameConfig.setConfig(config); | ||
|
||
//Start Game | ||
const game = new Phaser.Game(800, 680, Phaser.CANVAS, containerElement, null, false, false); | ||
game.state.add("Boot", Boot); | ||
game.state.add("Preload", Preload); | ||
game.state.add("GameTitle", GameTitle); | ||
game.state.add("Main", Main); | ||
game.state.add("GameOver", GameOver); | ||
game.state.start("Boot"); | ||
|
||
this.game = game; | ||
} | ||
|
||
/** | ||
* Destroys the current game instance | ||
* This will clean up memory | ||
*/ | ||
destroy() { | ||
GameConfig.reset(); | ||
if (this.game) { | ||
this.game.destroy(); | ||
this.game = null; | ||
} | ||
} | ||
|
||
} | ||
|
||
export default new Game(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
class GameOver { | ||
|
||
create(){ | ||
|
||
} | ||
|
||
restartGame() | ||
{ | ||
this.game.state.start("GameTitle"); | ||
} | ||
} | ||
|
||
export default GameOver; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
class GameTitle { | ||
|
||
create(){ | ||
this.game.state.start("Main"); | ||
} | ||
|
||
startGame() | ||
{ | ||
// this.game.state.start("Main"); | ||
} | ||
} | ||
|
||
export default GameTitle; |
Oops, something went wrong.