Skip to content

Latest commit

 

History

History
75 lines (51 loc) · 2.42 KB

development.md

File metadata and controls

75 lines (51 loc) · 2.42 KB

Development

Documentation for games development.

To keep the global namespace from being polluted we use the 'Revealing Module' pattern. That means our code will look like this:

const GAME = (function(){

}());

Check out the documentation below to see the interface expected from a game. For convenience you can copy the games/standard.js file to start writing a new game.

Browserbasedgames.net

On GitHub we develop all the games. They get compiled into a single JS file. We also create a website. The idea is that you can just drop that somehwere and call the website with some query parameter. It will then run the specified game. We also procide a global GAMES object which exposes all games so that their info can be used to generate previews. This approach will become somewhat lacking once we create more games or once with many resources. But for now it will work really good to keep development simple.

GAME : object

Global GAME. Reference it via the GAME variable.

Kind: global namespace
Properties

Name Type Description
info infoObject Infos about this game.

gamE.start()

Start the game.

Kind: instance method of GAME

gamE.pause()

Pause the game.

Kind: instance method of GAME

gamE.resume()

Resume the game.

Kind: instance method of GAME

gamE.setGameOverCallback()

Set the callback for gameOver.

Kind: instance method of GAME

gamE.infoObject : object

Kind: instance typedef of GAME
Properties

Name Type Description
name string Name of this game.
description string Desciption for this game.
imgUrl string URL to a preview image for this game.
manual string Information on how to play this game.