Documentation ¶
Index ¶
- Constants
- Variables
- func NewGame(w, h float64) (game *tentsuyu.Game, err error)
- type AI
- type AIController
- type AILauncher
- type AIUfo
- type Cannon
- func (c *Cannon) AddCommand(command Command)
- func (c Cannon) Draw(screen *ebiten.Image) error
- func (c Cannon) DrawRays(screen *ebiten.Image)
- func (c *Cannon) FireMissile(tx, ty float64) bool
- func (c *Cannon) Hit()
- func (c *Cannon) InFireRadius(x, y float64) bool
- func (c Cannon) IsAlive() bool
- func (c *Cannon) RemoveMissile(missileID string)
- func (c *Cannon) ShiftCommand() Command
- func (c *Cannon) Update(planet *Planet)
- type Command
- type Explosion
- type GameMain
- func (g *GameMain) Draw(game *tentsuyu.Game) error
- func (g GameMain) Msg() tentsuyu.GameStateMsg
- func (g *GameMain) RemoveExplosion(exID string)
- func (g *GameMain) RemoveUFO(exID string)
- func (g *GameMain) SetMsg(gs tentsuyu.GameStateMsg)
- func (g *GameMain) SetOverlay(text []string, displayTime int, offsetX, offsetY float64, clickToContinue bool)
- func (g *GameMain) StepZoom(camera *tentsuyu.Camera, zoomOut bool)
- func (g *GameMain) Update(game *tentsuyu.Game) error
- type Missile
- type MissileLauncher
- type Orbiter
- type Planet
- type Projectile
- type ScoreEntry
- type TitleScreen
Constants ¶
const ( MissileLauncherLeft = "LeftLauncher" MissileLauncherRight = "RightLauncher" MissileLauncherTop = "TopLauncher" MissileLauncherBottom = "BottomLauncher" )
These specifiy the edge of the screen MissileLauncher names/positions
Variables ¶
var ( Cannon1 = "CANNON A" //"ACAPULCO" Cannon2 = "CANNON B" //"BEIJING" Cannon3 = "CANNON C" //"COLOGNE" Cannon4 = "CANNON D" //"DALLAS" )
Names of the Cannons for UI purposes
var ( //ScreenWidth of the game ScreenWidth float64 //ScreenHeight of the game ScreenHeight float64 //FntMain is Kanit font FntMain = "FntKanit" //AngleDrawOffset is 90 degrees (All images in spritesheet face UP... Right is 0 degrees/radians) AngleDrawOffset = 1.5708 //SpriteSheets hold all the spritesheets for the game SpriteSheets = map[string]*tentsuyu.SpriteSheet{} )
var ( GameStateMsgMain tentsuyu.GameStateMsg = "MainGame" GameStateMsgTitle tentsuyu.GameStateMsg = "Game Title Screen" )
GameState Messages used for this game
var Game *tentsuyu.Game
Game is the tentsuyu.Game which contains all the relevant library attributes
Functions ¶
Types ¶
type AIController ¶
type AIController struct {
// contains filtered or unexported fields
}
AIController controls all the AI elements for the game
func CreateAIController ¶
func CreateAIController() *AIController
CreateAIController returns a new AIController
func (*AIController) Update ¶
func (a *AIController) Update(p *Planet)
Update the AIController. This will coordinate all different AI Types
type AILauncher ¶
type AILauncher struct { *MissileLauncher // contains filtered or unexported fields }
AILauncher controls the various missile launchers
func CreateAILauncher ¶
func CreateAILauncher(name string) *AILauncher
CreateAILauncher returns a new AILauncher
func CreateEdgeAILaunchers ¶
func CreateEdgeAILaunchers() []*AILauncher
CreateEdgeAILaunchers is a convenient function to return the 4 edge launchers
func (*AILauncher) LaunchMissile ¶
func (a *AILauncher) LaunchMissile(tx, ty float64)
LaunchMissile at the provided target x,y coords
func (*AILauncher) Update ¶
func (a *AILauncher) Update(planet *Planet)
Update the AILauncher and determine when to fire new missiles
type AIUfo ¶
type AIUfo struct { *tentsuyu.BasicObject Health int Destination *tentsuyu.Vector2d // contains filtered or unexported fields }
AIUfo controls the ufo that attacks the player planet
func (*AIUfo) Hit ¶
Hit updates the UFO to a hit state. Returns true if ufo was not in invulnerable state, otherwise returns false
type Cannon ¶
type Cannon struct { *tentsuyu.BasicObject Name string Health int // contains filtered or unexported fields }
Cannon is the player's way of attacking incoming threats
func CreateCannon ¶
CreateCannon returns a Cannon on the given planet at the starting angle (position on planet)
func (*Cannon) AddCommand ¶
AddCommand to command queue
func (*Cannon) FireMissile ¶
FireMissile returns true if the cannon is able to fire and creates a new missile
func (*Cannon) Hit ¶
func (c *Cannon) Hit()
Hit reduces the cannon's hp if it's not cooling down. The cooldown period prevents instant death
func (*Cannon) InFireRadius ¶
InFireRadius returns true if the given coords are within the cannon's "firing cone"
func (*Cannon) RemoveMissile ¶
RemoveMissile from the cannon's slice
func (*Cannon) ShiftCommand ¶
ShiftCommand removes the first element from the command queue and returns it.
type Explosion ¶
type Explosion struct { *tentsuyu.BasicObject // contains filtered or unexported fields }
Explosion is generated when a missile hits its target or reaches its destination
func CreateExplosion ¶
CreateExplosion at given coords
type GameMain ¶
type GameMain struct {
// contains filtered or unexported fields
}
GameMain represents the main GameState of our game
func NewGameMain ¶
NewGameMain returns our main gamestate
func (GameMain) Msg ¶
func (g GameMain) Msg() tentsuyu.GameStateMsg
Msg returns the gamestatemsg and achieves the GameState interface
func (*GameMain) RemoveExplosion ¶
RemoveExplosion from the game
func (*GameMain) SetMsg ¶
func (g *GameMain) SetMsg(gs tentsuyu.GameStateMsg)
SetMsg sets the gamestatemsg value
func (*GameMain) SetOverlay ¶
func (g *GameMain) SetOverlay(text []string, displayTime int, offsetX, offsetY float64, clickToContinue bool)
SetOverlay sets the text to display, the duration, the offeset of X,Y and if the text can be skipped by clicking
type Missile ¶
type Missile struct { *tentsuyu.BasicObject OriginX, OriginY float64 TargetX, TargetY float64 Velocity *tentsuyu.Vector2d Active bool // contains filtered or unexported fields }
Missile is the main projectile of the game
func CreateMissile ¶
CreateMissile returns a new Missile at the specified x,y coords with the target tx,ty
type MissileLauncher ¶
type MissileLauncher struct { *tentsuyu.BasicObject Name string // contains filtered or unexported fields }
MissileLauncher launches missiles
func CreateConstantMissileLauncher ¶
func CreateConstantMissileLauncher(name string) *MissileLauncher
CreateConstantMissileLauncher creates one of the 4 just off screen Missile Launchers that constantly launch missiles at our player
func CreateMissileLauncher ¶
func CreateMissileLauncher(x, y float64, width, height int, name string) *MissileLauncher
CreateMissileLauncher creates a MissileLauncher, which launches Missiles
func (*MissileLauncher) RemoveMissile ¶
func (m *MissileLauncher) RemoveMissile(missileID string)
RemoveMissile from the launcher's slice
type Orbiter ¶
type Orbiter struct { *tentsuyu.BasicObject // contains filtered or unexported fields }
Orbiter is an object designed to orbit a planet
func NewOrbiter ¶
NewOrbiter creates a new orbiter object
type Planet ¶
type Planet struct { *tentsuyu.BasicObject Health int }
Planet is what the player must protect
func CreatePlanet ¶
CreatePlanet at given coords with given width and height
type Projectile ¶
Projectile is the generic
type ScoreEntry ¶
type ScoreEntry struct {
Entry1, Entry2, Entry3 int
Text1, Text2, Text3, TitleText *tentsuyu.TextElement
CurrSelection int
StartX, StartY float64
Confirmed bool
// contains filtered or unexported fields
}
ScoreEntry updates and displays the entry screen for entering the initials for the high score screen
func NewScoreEntry ¶
func NewScoreEntry(x, y float64) *ScoreEntry
NewScoreEntry returns a new ScoreEntry at the given x,y coords
func (ScoreEntry) ToString ¶
func (s ScoreEntry) ToString() string
ToString returns the score entry 3 values as a single string
func (*ScoreEntry) Update ¶
func (s *ScoreEntry) Update(input *tentsuyu.InputController)
Update the ScoreEntry. Up and Down change the selected letter space either up or down the alphabet. Left and Right change which letter space is selected. Enter confirms the entry to a high score.
type TitleScreen ¶
type TitleScreen struct {
// contains filtered or unexported fields
}
TitleScreen represents the main GameState of our game
func NewTitleScreen ¶
func NewTitleScreen(game *tentsuyu.Game) *TitleScreen
NewTitleScreen returns our main gamestate
func (*TitleScreen) Draw ¶
func (g *TitleScreen) Draw(game *tentsuyu.Game) error
Draw the gamestate scene
func (TitleScreen) Msg ¶
func (g TitleScreen) Msg() tentsuyu.GameStateMsg
Msg returns the gamestatemsg and achieves the GameState interface
func (*TitleScreen) SetMsg ¶
func (g *TitleScreen) SetMsg(gs tentsuyu.GameStateMsg)
SetMsg sets the gamestatemsg value