Documentation ¶
Index ¶
- type Controls
- func (c *Controls) Draw(s *tl.Screen)
- func (c *Controls) HideMessageBox()
- func (c *Controls) MoveDown()
- func (c *Controls) MoveFocus()
- func (c *Controls) MoveUp()
- func (c *Controls) NextRound()
- func (c *Controls) PressButton()
- func (c *Controls) RestartRound()
- func (c *Controls) Shoot()
- func (c *Controls) ShowAttributes()
- func (c *Controls) ShowInfo()
- func (c *Controls) ShowScore()
- func (c *Controls) Tick(e tl.Event)
- type Game
- type GameOptions
- type Round
- func (r *Round) ActivateNextTank()
- func (r *Round) ActiveTank() *entities.Tank
- func (r *Round) Draw(s *tl.Screen)
- func (r *Round) IsFinished() bool
- func (r *Round) IsPlayerOnTurn() bool
- func (r *Round) IsTurnFinished() bool
- func (r *Round) Next()
- func (r *Round) Number() int
- func (r *Round) NumberOfTanksAlive() int
- func (r *Round) Restart()
- func (r *Round) Tick(e tl.Event)
- type RoundState
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Controls ¶
type Controls struct {
// contains filtered or unexported fields
}
Controls holds data and logic for controlling game world.
func (*Controls) HideMessageBox ¶
func (c *Controls) HideMessageBox()
HideMessageBox will hide any active message box
func (*Controls) MoveDown ¶
func (c *Controls) MoveDown()
MoveDown decreases cannon's angle of active tank
func (*Controls) MoveFocus ¶
func (c *Controls) MoveFocus()
MoveFocus moves focus to next component on currently opened form. If no form is opened ignore it.
func (*Controls) NextRound ¶
func (c *Controls) NextRound()
NextRound will switch game to the next round
func (*Controls) PressButton ¶
func (c *Controls) PressButton()
PressButton sends action event to currently opened form. If no form is opened ignore it.
func (*Controls) RestartRound ¶
func (c *Controls) RestartRound()
RestartRound will restart current round
func (*Controls) Shoot ¶
func (c *Controls) Shoot()
Shoot will start loading or shoot with active tank if it's already loading
func (*Controls) ShowAttributes ¶
func (c *Controls) ShowAttributes()
ShowAttributes shows attributes dialog
type Game ¶
type Game struct {
// contains filtered or unexported fields
}
Game holds information which is kept during whole session.
func NewGame ¶
func NewGame(o GameOptions) *Game
NewGame creates new game object. Game is not started yet. You need to call Start().
func (*Game) InitialSeed ¶
InitialSeed returns seed used for the first level.
type GameOptions ¶
type GameOptions struct { // Width of game world in number of console pixels (cells) Width int // Height of game world in number of console pixels (cells) Height int // PlayerCount is number of players which will be added to game PlayerCount int // Seed is number used as random seed and if it is reused it allows to play same game with same looking rounds Seed int64 // Fps sets screen framerate Fps int // AsciiOnly identifies that only ASCII characters can be used for all graphics ASCIIOnly bool // LowColor identifies that only 8 colors can be used for all graphics LowColor bool // BrowserMode identifies that game was run in browser and some controls need to be modified to do not collide with usual browser shortcuts BrowserMode bool // Debug turns on debug mode if set to true Debug bool }
GameOptions provide configuration needed for creating new game
type Round ¶
type Round struct {
// contains filtered or unexported fields
}
Round represents one round in the game. It is responsible for managing state of the round. It also provides functionality for transitions to next rounds. Use NewRound to create new instance. Add it to the termloop.Screen entities after creating. Call Restart to restart this round. Call Next to go to the next round.
func NewRound ¶
NewRound creates new round. Created round will be in Started state. It will add World as level after added to the screen.
func (*Round) ActivateNextTank ¶
func (r *Round) ActivateNextTank()
ActivateNextTank moves turn to nearest tank which is alive.
func (*Round) ActiveTank ¶
ActiveTank returns tank which is currently active / on turn.
func (*Round) IsFinished ¶
IsFinished returns true when round was already finished
func (*Round) IsPlayerOnTurn ¶
IsPlayerOnTurn returns turn when some player is on turn now and he didn't made his move yet
func (*Round) IsTurnFinished ¶
IsTurnFinished returns true if there are no bullets and explosions in world
func (*Round) NumberOfTanksAlive ¶
NumberOfTanksAlive returns how many tanks is still alive (in game).
type RoundState ¶
type RoundState uint8
RoundState represents state of the round
const ( // Started round is state right after round was created / started / restarted Started RoundState = iota // PlayerOnTurn is state when some player is on turn but it has not done his move yet PlayerOnTurn // WaitForTurnFinish is state when some player did his move and we are waiting for all consequences of the move WaitForTurnFinish // Finished is state when round was finished which means there is only one or zero tanks alive Finished )
Directories ¶
Path | Synopsis |
---|---|
Package debug provides access to debugging support.
|
Package debug provides access to debugging support. |
Package demo contains support for playing scripted demos.
|
Package demo contains support for playing scripted demos. |