game module¶
- game.getPlayer(allegiance)¶
get player with a said allegiance
- Parameters
allegiance (int) -- the player allegiance to be queried
- Returns
return the player in the player list associated with the right side
- Return type
int
- game.moveUnit(target, grid, inputQueue, background)¶
moving units
- Parameters
target (Unit obect) -- unit to move
grid (Grid object) -- the unit grid
inputQueue (multiprocess.JoinableQueue) -- input queue to tcp demon
background (Background object) -- Tiled background (the map) => water nnimation
- Returns
-2 : ennemy has died, -1 : I died (this player)
- Return type
int
- game.placeUnit(target, y, player, grid)¶
put unit on grid
- Parameters
target (Unit object) -- unit to place
y (int) -- y pos of the unit to place (x position = 0 or 19 depending on the unit side)
player (Player object) -- the player putting in the unit
grid (Grid object) -- unit grid
- game.resetPlayer()¶
reseting players (their money for a bug where when we back to menu and started a new game, the money would not be resetted)
- game.setPlayer(allegiance)¶
add the player to the player list
- Parameters
allegiance (int) -- the player side
- Returns
the player object, which is now part of the player list, with the right side
- Return type
Player object
- game.showHealth(screen)¶
display the players health
- Parameters
screen (pygame.Surface) -- screen where we put the players health
- game.showUnits(grid)¶
show unit => put unit on screen
- Parameters
grid (Grid object) -- grid in which we put the unit
- game.showWealth(screen)¶
display the players health
- Parameters
screen (pygame.Surface) -- screen where we put the player money
- game.spawnUnit(screen, grid, joueur)¶
create unit
- Parameters
screen (pygame.Surface) -- screen where the unit would be displayed
grid (Grid object) -- unit grid
joueur (Player object) -- player that own the unit
- Returns
return the created unit
- Return type
Unit object
- game.takeUnitFromAline(grid, y)¶
take all units from a line otherwise some units might go too fast
- Parameters
grid (Grid object) -- unit grid
y (int) -- y coordinate of the line
- Returns
return all the unit in the line
- Return type
list