-
Notifications
You must be signed in to change notification settings - Fork 6
game module explanation
The game is divided into sections in the /ng-modules/ directory. I'm currently calling these game modules/screen/section directives. These modules include models, views, and controls for each "unit" of gameplay. For demonstration purposes, the "main menu" is a gameplay module.
I know this sounds like things are way overcomplicated, but I think the benefit of being able to segment out game sections for development is worth it in this case, so hang in there and I think you'll learn to like it.
Anything can be a module, but game modules can generally be thought of a "scenes".
In order to debug a module without traversing the whole game to get there, you can just navigate to localhost:8000/ng-modules/yourModuleName/
and you should get a fully loaded game at your module.
The main controller will show()
your module when another modules asks for it by name via an event. Likewise, in order for you to switch to another module, you do something like $emit('switchToModule', 'main-menu')
To read from the "global" game you should use the "data" service inside the "game" module. To do this, add require('game') to your module's dependencies, and add "data" to your controller's list of services.
Adding "game" module as dependency:
var app = angular.module('game-module-name', [
require('game'),
// other required modules here
]);
Accessing the game.data service:
app.controller("oneOfMyModuleControllers", ['data', function(data){
console.log(data.shipHealth);
}
The data attributes and other methods on the game class used by game.data are in ng-modules/game.coffee
. Ideally, use methods of this class to do game-logic related computations.
#Nav
- Locations
- KSC, Earth
- ISS, LEO
- Moonbase Alpha, Moon
- ...
- Planetary bodies
- Earth
- Moon
- Ceres
- Mars
- Jupiter
- Europa
- Ships
- J-R0D
- Orion mk3
- Trajectories
- story:
- Gameplay
- Characters
- art style:
- sound design
- UI