Documentation
¶
Index ¶
- type Game
- func (g *Game) AddAsteroid(asteroidImage *ebiten.Image)
- func (g *Game) Draw(screen *ebiten.Image)
- func (g *Game) DrawAgents(screen *ebiten.Image)
- func (g *Game) Layout(outsideWidth, outsideHeight int) (screenWidth, screenHeight int)
- func (g *Game) LoadImage(file string) (*ebiten.Image, error)
- func (g *Game) Register(agent physics.Physic)
- func (g *Game) RestartGame()
- func (g *Game) Score() int
- func (g *Game) StartGame()
- func (g *Game) String() string
- func (g *Game) Unregister(id, agentType string)
- func (g *Game) Update() error
- func (g *Game) UpdateAgents()
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Game ¶
type Game struct { ScreenWidth float64 ScreenHeight float64 // contains filtered or unexported fields }
func (*Game) AddAsteroid ¶
func (g *Game) AddAsteroid(asteroidImage *ebiten.Image)
AddAsteroid insert a new asteroid in the game.
func (*Game) Draw ¶
func (g *Game) Draw(screen *ebiten.Image)
Draw draws the game screen. Draw is called every frame (typically 1/60[s] for 60Hz display).
func (*Game) DrawAgents ¶
func (g *Game) DrawAgents(screen *ebiten.Image)
DrawAgents loops over all game agents to update them
func (*Game) Layout ¶
Layout takes the outside size (e.g., the window size) and returns the (logical) screen size. If you don't have to adjust the screen size with the outside size, just return a fixed size.
func (*Game) RestartGame ¶
func (g *Game) RestartGame()
RestartGame cleans current game and a start a new game.
func (*Game) Unregister ¶
Unregister deletes an agent (player or ai) from the game.
func (*Game) Update ¶
Update proceeds the game state. Update is called every tick (1/60 [s] by default).
func (*Game) UpdateAgents ¶
func (g *Game) UpdateAgents()
UpdateAgents loops over all game agents to update them