Game Development Reference
In-Depth Information
"ones_score":{frames:[178] },
"twos":{frames:[275, 276, 277 ... 294] },
"twos_score":{frames:[295] },
"threes":{frames:[253, 254, 255 ... 272] },
"threes_score":{frames:[273] },
"fours":{frames:[94, 95, 96 ... 113] },
"fours_score":{frames:[114] },
"fives":{frames:[73, 74, 75 ... 92] },
"fives_score":{frames:[93] },
"sixes":{frames:[184, 185, 186 ... 203] },
"sixes_score":{frames:[204] },
"threeKind":{frames:[0, 1, 2, 3 ... 19] },
"threeKind_score":{frames:[20] },
"fourKind":{frames:[21, 22, 23 ... 40] },
"fourKind_score":{frames:[41] },
"small":{frames:[205, 206, 207 ... 224] },
"small_score":{frames:[225] },
"large":{frames:[136, 137, 138 ... 155] },
"large_score":{frames:[156] },
"fullHouse":{frames:[115, 116, 117 ... 134] },
"fullHouse_score":{frames:[135] },
"chance":{frames:[42, 43, 44 ... 61] },
"chance_score":{frames:[62] },
"playAgain":[179],
"playGame":[180],
"rollButton":[181],
"rollMessage":[182],
"scoreBar":[183],
"totalScoreLabel":[274]
}
With the sprite sheet data set up and ready to load, the game programming can begin.
Beginning the Game Code
As usual, the game code begins by declaring a series of constants and variables, the preloading of assets, and the
initializing functions that will begin building the elements that make your game. The fakezee.js file will be used
to program the game logic.
Declaring the Game Constants and Variables
The constants in Fakezee are used to position the main containers and store values needed to make up the game.
Listing 7-3 shows these constants.
Listing 7-3. Constants Used in fakezee.js for Counts and Positioning
const TITLE_YPOS = 15;
const DICE_TRAY_POSITION = {x:78, y:78};
const SCORE_CARD_POSITION = {x:20, y:155};
const SCOREBOARD_POSITION = {x:75, y:460};
 
Search WWH ::




Custom Search