Initial prompt
MazZero
User prompt
Add these globals : // Game state variables var GAME_STATE = { INIT: 'INIT', MENU: 'MENU', NEW_ROUND: 'NEW_ROUND', PLAYING: 'PLAYING', SCORE: 'SCORE' }; var currentState = GAME_STATE.INIT;
User prompt
add initializeGame function and move all elements initialzation inside
User prompt
add initializeGame function and move all elements initialzation inside. all elements should be kept as global vairables. no locals in initializeGame
User prompt
remove duplicate
User prompt
move event handlers out of inifunction under a cmment /**** * Event Handlers ****/
User prompt
for each game state create 3 functions:initXXXState, handleXXXLoop and cleanXXXState
User prompt
add a new global debug = true and a new utility function function log() { if (debug) { console.log.apply(console, arguments); } }
User prompt
replace console.log by log() except in log() funciton ;)
User prompt
fix initXXXState, handleXXXLoop and cleanXXXState naming by using camel case (ie: initMenuState not initMENUState, ...)
Code edit (1 edits merged)
Please save this source code
User prompt
add and implement changeGameState(newState) (add detailed logs using log())
Code edit (1 edits merged)
Please save this source code
User prompt
in initializeGame call // Transition to menu state changeGameState(GAME_STATE.MENU);
Code edit (1 edits merged)
Please save this source code
User prompt
add global isPlaying = false
Code edit (1 edits merged)
Please save this source code
User prompt
add a new startButton asset and class; initialze it in game initialze and but show it only in menu state
User prompt
Please fix the bug: 'startButton is not defined' in or related to this line: 'startButton.visible = true;' Line Number: 146
Code edit (6 edits merged)
Please save this source code
Code edit (1 edits merged)
Please save this source code
User prompt
move puzzleManager.initPuzzle(); in initNewRound
User prompt
add 3 global containers layers
User prompt
add 3 global containers layers for background, middle and foreground
User prompt
Initialization of globals shoud come in initialzeGame
===================================================================
--- original.js
+++ change.js
@@ -80,65 +80,65 @@
}
}
function initINITState() {
// Initialize the game state for INIT
- console.log("Initializing INIT State");
+ log("Initializing INIT State");
}
function handleINITLoop() {
// Handle the game loop for INIT state
- console.log("Handling INIT Loop");
+ log("Handling INIT Loop");
}
function cleanINITState() {
// Clean up the game state for INIT
- console.log("Cleaning INIT State");
+ log("Cleaning INIT State");
}
function initMENUState() {
// Initialize the game state for MENU
- console.log("Initializing MENU State");
+ log("Initializing MENU State");
}
function handleMENULoop() {
// Handle the game loop for MENU state
- console.log("Handling MENU Loop");
+ log("Handling MENU Loop");
}
function cleanMENUState() {
// Clean up the game state for MENU
- console.log("Cleaning MENU State");
+ log("Cleaning MENU State");
}
function initNEW_ROUNDState() {
// Initialize the game state for NEW_ROUND
- console.log("Initializing NEW_ROUND State");
+ log("Initializing NEW_ROUND State");
}
function handleNEW_ROUNDLoop() {
// Handle the game loop for NEW_ROUND state
- console.log("Handling NEW_ROUND Loop");
+ log("Handling NEW_ROUND Loop");
}
function cleanNEW_ROUNDState() {
// Clean up the game state for NEW_ROUND
- console.log("Cleaning NEW_ROUND State");
+ log("Cleaning NEW_ROUND State");
}
function initPLAYINGState() {
// Initialize the game state for PLAYING
- console.log("Initializing PLAYING State");
+ log("Initializing PLAYING State");
}
function handlePLAYINGLoop() {
// Handle the game loop for PLAYING state
- console.log("Handling PLAYING Loop");
+ log("Handling PLAYING Loop");
}
function cleanPLAYINGState() {
// Clean up the game state for PLAYING
- console.log("Cleaning PLAYING State");
+ log("Cleaning PLAYING State");
}
function initSCOREState() {
// Initialize the game state for SCORE
- console.log("Initializing SCORE State");
+ log("Initializing SCORE State");
}
function handleSCORELoop() {
// Handle the game loop for SCORE state
- console.log("Handling SCORE Loop");
+ log("Handling SCORE Loop");
}
function cleanSCOREState() {
// Clean up the game state for SCORE
- console.log("Cleaning SCORE State");
+ log("Cleaning SCORE State");
}
/****
* Event Handlers
****/
tick
Sound effect
tileEntrance
Sound effect
tileRemove
Sound effect
operationSelect
Sound effect
operationCancel
Sound effect
tileChangeValue
Sound effect
resetSound
Sound effect
levelFailed
Sound effect
menuLevelSelect
Sound effect
menuCellEnter
Sound effect
applause
Sound effect
bgMusic
Music
tada
Sound effect