Skip to content

Commit

Permalink
BoardSize is in GlobalSettings.
Browse files Browse the repository at this point in the history
  • Loading branch information
RandolphBurt committed Sep 2, 2013
1 parent e0d876f commit a8a9448
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 22 deletions.
5 changes: 3 additions & 2 deletions App/js/directives/GameEngineDirective.js
@@ -1,6 +1,6 @@
'use strict';

gameApp.directive('gameEngine', function($timeout, GameEngine) {
gameApp.directive('gameEngine', function($timeout, GameEngine, GlobalSettings) {
return {
restrict: 'E',
template: '<canvas id="gameCanvas" width="600" height="600" style="border:1px solid #000000;"></canvas>',
Expand All @@ -12,7 +12,8 @@ gameApp.directive('gameEngine', function($timeout, GameEngine) {
var animation = 0;
var date = new Date();
var canvas = element.find('canvas')[0].getContext("2d");
GameEngine.initialise(canvas, 'img/graphics.png', { width: 30, height: 30, scale: 1 }, scope.gameState);

GameEngine.initialise(canvas, 'img/graphics.png', { width: GlobalSettings.gameBoardWidth, height: GlobalSettings.gameBoardHeight, scale: 1 }, scope.gameState);

function gameLoop() {
var nextTick = date.getTime() + 60;
Expand Down
43 changes: 23 additions & 20 deletions App/js/services/GlobalSettings.js
@@ -1,30 +1,33 @@
'use strict';

gameApp.constant("GlobalSettings", {
spriteSize: 20,
spriteSheetWidth: 4,
playerAreaHeight: 6,
spriteSize: 20,
spriteSheetWidth: 4,
playerAreaHeight: 6,

centipedeFramesPerMoveNormalSpeed: 2,
centipedeFramesPerMoveHighSpeed: 1,
gameBoardWidth: 30,
gameBoardHeight: 30,

// board creation
mushroomChanceNonPlayerArea: 10,
mushroomChancePlayerArea: 40,
centipedeFramesPerMoveNormalSpeed: 2,
centipedeFramesPerMoveHighSpeed: 1,

minMushroomsBeforeFleaCreated: 40,
minMushroomsInPlayerAreaBeforeFleaCreated: 5,
// board creation
mushroomChanceNonPlayerArea: 10,
mushroomChancePlayerArea: 40,

fleaCreationChance: 100,
spiderCreationChance: 25,
snailCreationChance: 200,
minMushroomsBeforeFleaCreated: 40,
minMushroomsInPlayerAreaBeforeFleaCreated: 5,

maxBulletsOnScreen: 5,
fleaCreationChance: 100,
spiderCreationChance: 25,
snailCreationChance: 200,

scoreHitMushroom: 10,
scoreHitPoisonMushroom: 25,
scoreHitCentipede: 100,
scoreHitSpider: 1000,
scoreHitFlea: 250,
scoreHitSnail: 500
maxBulletsOnScreen: 5,

scoreHitMushroom: 10,
scoreHitPoisonMushroom: 25,
scoreHitCentipede: 100,
scoreHitSpider: 1000,
scoreHitFlea: 250,
scoreHitSnail: 500
});

0 comments on commit a8a9448

Please sign in to comment.