Documentation ¶
Index ¶
- Variables
- func DrawBunker(t Terrain, at int, color uint, canvas *image.Paletted)
- func NewBunkerGame() games.Game
- func Render(state BunkersGameState) (string, error)
- func RenderAnimation(state BunkersGameState) (string, error)
- type BunkersGame
- type BunkersGameResult
- type BunkersGameState
- type BunkersGameStep
- type Shot
- type Terrain
Constants ¶
This section is empty.
Variables ¶
View Source
var ( WIDTH = 800 HEIGHT = 600 SKY = 0 GROUND = 1 PLAYER_A = 2 PLAYER_B = 3 TRAIL = 4 EXPLOSION = 5 PALETTE = []color.Color{ color.RGBA{R: 200, G: 200, B: 255, A: 255}, color.RGBA{R: 100, G: 220, B: 70, A: 255}, color.RGBA{R: 255, G: 0, B: 0, A: 255}, color.RGBA{R: 0, G: 0, B: 255, A: 255}, color.RGBA{R: 255, G: 100, B: 0, A: 255}, color.RGBA{R: 255, G: 255, B: 200, A: 255}, } EXPLOSION_RADIUS = 25 GRAVITY = 10.0 WIND_FACTOR = 0.5 )
Functions ¶
func NewBunkerGame ¶
func Render ¶
func Render(state BunkersGameState) (string, error)
Render the state into a png file and save it as as media files returns the full url of the file
func RenderAnimation ¶
func RenderAnimation(state BunkersGameState) (string, error)
Types ¶
type BunkersGame ¶
type BunkersGame struct{}
func (*BunkersGame) NewState ¶
func (t *BunkersGame) NewState() interface{}
NewState implements games.Game.
func (*BunkersGame) OnMsg ¶
func (t *BunkersGame) OnMsg(session *models.GameSession, msg games.GameMsg) (interface{}, games.GameReply, error)
type BunkersGameResult ¶
type BunkersGameResult struct {
Winner int // 0 == None, 1 == PlayerA, 2 == PlayerB
}
type BunkersGameState ¶
type BunkersGameState struct { InitTerrain Terrain PosA int PosB int PlayerA string PlayerB string WhosTurn int // 1 = PlayerA, 2 = PlayerB Shots []Shot Init bool Wind int Ended bool }
func NewBunkersGameState ¶
func NewBunkersGameState(a string, b string) *BunkersGameState
func (*BunkersGameState) Step ¶
func (s *BunkersGameState) Step(step BunkersGameStep) BunkersGameResult
func (*BunkersGameState) Terrain ¶
func (s *BunkersGameState) Terrain() Terrain
func (*BunkersGameState) TerrainAtShot ¶
func (s *BunkersGameState) TerrainAtShot(step int) Terrain
get terrain at a given stepp step 0 = before any short step n = after shot n is applied
type BunkersGameStep ¶
type Shot ¶
func (*Shot) DestroyTerrain ¶
DestroyTerrain returns a new terrain with the effect of the shot
Click to show internal directories.
Click to hide internal directories.