forked from mozilla/BrowserQuest
-
Notifications
You must be signed in to change notification settings - Fork 4
Code spelunking
OmeGak edited this page Aug 21, 2012
·
2 revisions
In this page we'll be posting the investigations we are performing over the least obvious BrowserQuest pieces of code. Feel free to add a section if you had a hard time figuring out anything, you will probably help someone in the future. ;)
In order to encourage a modular code, this project uses RequireJS.
index.html triggers: (via rquire-jquery) initApp() in main.js.
- home.js
initApp():
- i think this calls init() of most of the main game classes referenced below.
Then the page/game waits till a new player is created or joins.
client/js/main.js: app.tryStartingGame() client/js/app.js: tryStartingGame() calls startGame() calls start()
- sets some server options. game.username (ie player-selected username) is set here.
- calls this.game.run() client/js/game.js: run()
- calls initPlayer(), which sets the sprite according to this.player.getSpriteName(); the sprite is actually hard coded into the Player class as "clotharmor"; the "kind" is used to