Class Index | File Index

Classes


Class Game


Defined in: game.js.

Class Summary
Constructor Attributes Constructor Name and Description
 
Game()
Class Game
Method Summary
Method Attributes Method Name and Description
 
Adds a new player to current game from an user .
 
Change turn to the next player (immediately)
 
Launchs the game when a maximum number of players is reached
 
Downloads one map from a data map file
 
getCell(x, y)
Get a cell by coodinates x and y
 
getNextPlayer(currentTurn)
Get player who has next turn
 
Alias for getPlayerById
 
Get a player by attribute "id"
 
Get a player by attribute "turn"
 
Get a game list of players identities.
 
getUnit(id)
Alias for getUnitById
 
Get a unit in game by attribute "cell"
 
Get a unit in game by attribute "id"
 
Change turn to the next player (according to Timer)
 
onUpdate(context)
 
Set the turn order for each player.
 
removePlayer(PlayerId)
Set to false a play attribute of player.
 
Start playing in turn Player whose turn is 0 will be the first
 
Start Timer for playing in turn (in miliseconds)
 
Stop playing
 
Class Detail
Game()
Class Game
Author: Youness HAMRI - youness.hamri@gmail.com / Van Duc NGUYEN - ducnguyen272@yahoo.com.
Method Detail
addPlayer()
Adds a new player to current game from an user .
Parameters:
user.
Returns:
player.

changeTurn()
Change turn to the next player (immediately)

checkState()
Launchs the game when a maximum number of players is reached
Returns:
this

downloadMapFromFile(file)
Downloads one map from a data map file
Parameters:
file

getCell(x, y)
Get a cell by coodinates x and y
Parameters:
x
Coordinate x of this cell
y
Coordinate y of this cell
Returns:
cell

getNextPlayer(currentTurn)
Get player who has next turn
Parameters:
currentTurn
Turn of current player
Returns:
player

getPlayer(id)
Alias for getPlayerById
Parameters:
id
See:
getPlayerById

getPlayerById(id)
Get a player by attribute "id"
Parameters:
id
Id of player
Returns:
player

getPlayerByTurn(turn)
Get a player by attribute "turn"
Parameters:
turn
Turn of player
Returns:
player

getPlayersIds()
Get a game list of players identities.
Returns:
PlayersIds

getUnit(id)
Alias for getUnitById
Parameters:
id
See:
getUnitById

getUnitByCell(cell)
Get a unit in game by attribute "cell"
Parameters:
cell
Cell represents position of unit
Returns:
unit

getUnitById(id)
Get a unit in game by attribute "id"
Parameters:
id
Id of unit
Returns:
unit

nextTurn()
Change turn to the next player (according to Timer)

onUpdate(context)
Parameters:
context

orderPlayers()
Set the turn order for each player.
Returns:
this.

removePlayer(PlayerId)
Set to false a play attribute of player.
Parameters:
PlayerId
(a player identity)

startPlaying()
Start playing in turn Player whose turn is 0 will be the first

startTimer()
Start Timer for playing in turn (in miliseconds)

stopPlaying()
Stop playing

toJSON()

Documentation generated by JsDoc Toolkit 2.4.0 on Tue Apr 05 2011 21:22:01 GMT+0200 (CEST)