Documentation
¶
Index ¶
- Constants
- Variables
- func DrawTurret(screen *ebiten.Image, screenOp *ebiten.DrawImageOptions, ...)
- func DrawWaves(w *World, screen *ebiten.Image, spawnerOp *ebiten.DrawImageOptions)
- func GetDirection(sx, sy, tx, ty float64) (float64, float64)
- func GetDistanceVector(sx, sy, tx, ty float64) (float64, float64)
- func GetMagnitude(x, y float64) float64
- func GetToolImage(t ToolKind, k string) *ebiten.Image
- func IsWithinRadius(sx, sy, tx, ty, radius float64) bool
- func Normalize(vX, vY, magnitude float64) (float64, float64)
- func ObjectsNearest[K interface{ ... }](l []K, x, y float64) []K
- func ObjectsWithPolarity[K interface{ ... }](l []K, p data.Polarity) []K
- func ObjectsWithinRadius[K interface{ ... }](l []K, x, y, radius float64) []K
- type ActorEntity
- type Animation
- type BaseEntity
- func (e *BaseEntity) Action() EntityAction
- func (e *BaseEntity) Animation() *Animation
- func (e *BaseEntity) CanPathfind() bool
- func (e *BaseEntity) IsCollided(t Entity) bool
- func (e *BaseEntity) IsProjectile() bool
- func (e *BaseEntity) IsWithinMagneticField(t Entity) bool
- func (e *BaseEntity) NetID() int
- func (e *BaseEntity) Physics() *PhysicsObject
- func (e *BaseEntity) SetAction(a EntityAction)
- func (e *BaseEntity) SetNetID(nid int)
- func (e *BaseEntity) SetSteps(s []pathing.Step)
- func (e *BaseEntity) Trash()
- func (e *BaseEntity) Trashed() bool
- func (e *BaseEntity) Turret() *Turret
- type BuildMode
- type CollectOrbRequest
- type CoreEntity
- type DamageCoreRequest
- type DummyRequest
- type EnemyEntity
- type Entity
- type EntityAction
- type EntityActionMove
- type EntityActionPlace
- type EntityActionShoot
- type EntityPropertySync
- type Game
- type LiveCell
- type LossMode
- type MultiRequest
- type OrbEntity
- type PhysicsObject
- type PlaySoundRequest
- type Player
- type PointsSync
- type PostGameMode
- type PreGameMode
- type ProgressBar
- type ProjecticleEntity
- type Request
- type SelectToolbeltItemRequest
- type SpawnEnemyRequest
- type SpawnOrbRequest
- type SpawnProjecticleRequest
- type SpawnToolEntityRequest
- type SpawnerEntity
- type StartModeRequest
- type ToolKind
- type Toolbelt
- type ToolbeltItem
- type TouchContainer
- type TrashEntityRequest
- type Turret
- type TurretBeamEntity
- type TurretEntity
- type UseToolRequest
- type VictoryMode
- type WallEntity
- type WaveMode
- type World
- func (w *World) AreCoresDead() bool
- func (w *World) AreEnemiesDead() bool
- func (w *World) ArePlayersReady() bool
- func (w *World) AreSpawnersHolding() bool
- func (w *World) AreWavesComplete() bool
- func (w *World) BuildFromLevel(level data.Level) error
- func (w *World) CollectOrb(r CollectOrbRequest)
- func (w *World) DamageCore(r DamageCoreRequest)
- func (w *World) Draw(screen *ebiten.Image)
- func (w *World) GetCell(x, y int) *LiveCell
- func (w *World) GetClosestCellPosition(x, y int) (int, int)
- func (w *World) GetCursorPosition() (x, y int)
- func (w *World) GetNextNetID() int
- func (w *World) HandleToolRequest(r UseToolRequest) Entity
- func (w *World) IsPlacementValid(placeX, placeY int) bool
- func (w *World) PlaceEntityAt(e Entity, x, y float64)
- func (w *World) PlaceEntityInCell(e Entity, x, y int)
- func (w *World) ProcessNetMessage(msg net.Message) error
- func (w *World) ProcessRequest(r Request)
- func (w *World) SendPlayerPoints()
- func (w *World) SetMode(m WorldMode)
- func (w *World) SetWaves()
- func (w *World) SpawnEnemyEntity(r SpawnEnemyRequest) *EnemyEntity
- func (w *World) SpawnOrbEntity(r SpawnOrbRequest) *OrbEntity
- func (w *World) SpawnProjecticleEntity(r SpawnProjecticleRequest) *ProjecticleEntity
- func (w *World) SplitPoints(value int)
- func (w *World) SyncEntity(r EntityPropertySync)
- func (w *World) SyncPoints(r PointsSync)
- func (w *World) Update() error
- func (w *World) UpdateEntityPathing(e Entity)
- func (w *World) UpdatePathing()
- type WorldMode
Constants ¶
const ( ToolNone ToolKind = "none" ToolGun = "gun" ToolTurret = "turret" ToolWall = "wall" ToolDestroy = "destroy" )
Variables ¶
var ScreenHeight int = 360
var ScreenWidth int = 640
FIXME: This is a sin.
Functions ¶
func DrawTurret ¶
func DrawWaves ¶
func DrawWaves(w *World, screen *ebiten.Image, spawnerOp *ebiten.DrawImageOptions)
This is _not_ the place for this.
func GetDirection ¶
Takes two sets of coordinates Returns a normalized vector for the direction from s to t
func GetDistanceVector ¶
Returns distance between two points on each axis
func GetToolImage ¶
Retrieves the image for a toolkind TODO: perhaps intialize toolbelt items with these instead?
func IsWithinRadius ¶
func ObjectsNearest ¶
func ObjectsNearest[K interface{ Physics() *PhysicsObject }](l []K, x, y float64) []K
func ObjectsWithPolarity ¶
func ObjectsWithPolarity[K interface{ Physics() *PhysicsObject }](l []K, p data.Polarity) []K
func ObjectsWithinRadius ¶
func ObjectsWithinRadius[K interface{ Physics() *PhysicsObject }](l []K, x, y, radius float64) []K
ObjectsWithinRadius is a generic function that can apply to a slice of any object that has a Physics() *PhysicsObject method.
Types ¶
type ActorEntity ¶
type ActorEntity struct { BaseEntity // contains filtered or unexported fields }
func NewActorEntity ¶
func NewActorEntity(player *Player, config data.EntityConfig) *ActorEntity
func (*ActorEntity) Draw ¶
func (e *ActorEntity) Draw(screen *ebiten.Image, screenOp *ebiten.DrawImageOptions)
type Animation ¶
type Animation struct {
// contains filtered or unexported fields
}
Animation manages updating and iterating through a slice of images.
func NewAnimation ¶
func (*Animation) Draw ¶
func (a *Animation) Draw(screen *ebiten.Image, op *ebiten.DrawImageOptions)
Draw draws the current animation image to screen.
func (*Animation) Image ¶
func (a *Animation) Image() *ebiten.Image
Image returns the current image frame.
type BaseEntity ¶
type BaseEntity struct {
// contains filtered or unexported fields
}
func (*BaseEntity) Action ¶
func (e *BaseEntity) Action() EntityAction
func (*BaseEntity) Animation ¶
func (e *BaseEntity) Animation() *Animation
func (*BaseEntity) CanPathfind ¶
func (e *BaseEntity) CanPathfind() bool
func (*BaseEntity) IsCollided ¶
func (e *BaseEntity) IsCollided(t Entity) bool
Check whether or not the provided entity collides Should probably use entity sprites or add hitboxes to physics object
func (*BaseEntity) IsProjectile ¶
func (e *BaseEntity) IsProjectile() bool
func (*BaseEntity) IsWithinMagneticField ¶
func (e *BaseEntity) IsWithinMagneticField(t Entity) bool
Check whether or not the provided entity is within magnetic field
func (*BaseEntity) NetID ¶
func (e *BaseEntity) NetID() int
func (*BaseEntity) Physics ¶
func (e *BaseEntity) Physics() *PhysicsObject
func (*BaseEntity) SetAction ¶
func (e *BaseEntity) SetAction(a EntityAction)
func (*BaseEntity) SetNetID ¶
func (e *BaseEntity) SetNetID(nid int)
func (*BaseEntity) SetSteps ¶
func (e *BaseEntity) SetSteps(s []pathing.Step)
func (*BaseEntity) Trash ¶
func (e *BaseEntity) Trash()
func (*BaseEntity) Trashed ¶
func (e *BaseEntity) Trashed() bool
func (*BaseEntity) Turret ¶
func (e *BaseEntity) Turret() *Turret
type BuildMode ¶
type BuildMode struct {
// contains filtered or unexported fields
}
BuildMode leads to Wave mode.
func (BuildMode) Type ¶
func (m BuildMode) Type() net.TypedMessageType
type CollectOrbRequest ¶
type CollectOrbRequest struct { Worth int `json:"w"` Collector string `json:"c"` // contains filtered or unexported fields }
func (CollectOrbRequest) Type ¶
func (r CollectOrbRequest) Type() net.TypedMessageType
type CoreEntity ¶
type CoreEntity struct { BaseEntity // contains filtered or unexported fields }
func NewCoreEntity ¶
func NewCoreEntity(config data.EntityConfig) *CoreEntity
func (*CoreEntity) Draw ¶
func (e *CoreEntity) Draw(screen *ebiten.Image, screenOp *ebiten.DrawImageOptions)
type DamageCoreRequest ¶
type DamageCoreRequest struct { ID int `json:"i"` // The ID of the core that took damage. Damage int `json:"d"` // The Damage value. }
func (DamageCoreRequest) Type ¶
func (r DamageCoreRequest) Type() net.TypedMessageType
type DummyRequest ¶
type DummyRequest struct { }
DummyRequest is used to prevent action passthrough.
func (DummyRequest) Type ¶
func (r DummyRequest) Type() net.TypedMessageType
type EnemyEntity ¶
type EnemyEntity struct { BaseEntity // contains filtered or unexported fields }
func NewEnemyEntity ¶
func NewEnemyEntity(config data.EntityConfig) *EnemyEntity
func (*EnemyEntity) CanPathfind ¶
func (e *EnemyEntity) CanPathfind() bool
func (*EnemyEntity) Draw ¶
func (e *EnemyEntity) Draw(screen *ebiten.Image, screenOp *ebiten.DrawImageOptions)
func (*EnemyEntity) SetSteps ¶
func (e *EnemyEntity) SetSteps(s []pathing.Step)
type Entity ¶
type Entity interface { Physics() *PhysicsObject Turret() *Turret Animation() *Animation Trashed() bool Trash() Update(world *World) (Request, error) Draw(screen *ebiten.Image, op *ebiten.DrawImageOptions) // Eh, might as well allow the entities to draw themselves. Action() EntityAction SetAction(a EntityAction) IsCollided(t Entity) bool IsWithinMagneticField(t Entity) bool // Why not. CanPathfind() bool SetSteps(p []pathing.Step) NetID() int SetNetID(nid int) IsProjectile() bool }
type EntityAction ¶
type EntityAction interface { // Replaceble returns if the action can be immediately replaced by another. Replaceable() bool // Complete returns if the action is completed. If it is, then it is removed by the entity. Complete() bool GetNext() EntityAction Type() net.TypedMessageType }
EntityAction is the interface to represent an entity's desired action.
type EntityActionMove ¶
type EntityActionMove struct { // x and y represents the target position to move to. X float64 `json:"x"` Y float64 `json:"y"` // distance represents the distance from the target that should be considered valid. Distance float64 `json:"d"` // Next EntityAction `json:"n"` // contains filtered or unexported fields }
EntityActionMove represents an action that should move the entity towards a target location.
func (*EntityActionMove) Complete ¶
func (a *EntityActionMove) Complete() bool
func (*EntityActionMove) GetNext ¶
func (a *EntityActionMove) GetNext() EntityAction
func (*EntityActionMove) Replaceable ¶
func (a *EntityActionMove) Replaceable() bool
func (EntityActionMove) Type ¶
func (a EntityActionMove) Type() net.TypedMessageType
Here be code to add network support to above actions.
type EntityActionPlace ¶
type EntityActionPlace struct { // x and y are cell positions to place at. X int Y int Tool ToolKind `json:"t"` Kind string `json:"k"` Polarity data.Polarity `json:"p"` // contains filtered or unexported fields }
func (*EntityActionPlace) Complete ¶
func (a *EntityActionPlace) Complete() bool
func (*EntityActionPlace) GetNext ¶
func (a *EntityActionPlace) GetNext() EntityAction
func (*EntityActionPlace) Replaceable ¶
func (a *EntityActionPlace) Replaceable() bool
func (EntityActionPlace) Type ¶
func (a EntityActionPlace) Type() net.TypedMessageType
type EntityActionShoot ¶
type EntityActionShoot struct { // targetX and targetY represent the position to fire at. TargetX float64 `json:"x"` TargetY float64 `json:"y"` Polarity data.Polarity `json:"p"` Next EntityAction `json:"n"` // contains filtered or unexported fields }
func (*EntityActionShoot) Complete ¶
func (a *EntityActionShoot) Complete() bool
func (*EntityActionShoot) GetNext ¶
func (a *EntityActionShoot) GetNext() EntityAction
func (*EntityActionShoot) Replaceable ¶
func (a *EntityActionShoot) Replaceable() bool
func (EntityActionShoot) Type ¶
func (a EntityActionShoot) Type() net.TypedMessageType
type EntityPropertySync ¶
func (EntityPropertySync) Type ¶
func (r EntityPropertySync) Type() net.TypedMessageType
type LiveCell ¶
type LiveCell struct {
// contains filtered or unexported fields
}
LiveCell is a position in a live level.
type LossMode ¶
type LossMode struct {
// contains filtered or unexported fields
}
LossMode represents when the core 'splodes. Leads to a restart of the current.
func (LossMode) Type ¶
func (m LossMode) Type() net.TypedMessageType
type MultiRequest ¶
type MultiRequest struct {
Requests []Request `json:"r"`
}
MultiRequest is a container for multiple requests.
func (MultiRequest) Type ¶
func (r MultiRequest) Type() net.TypedMessageType
Here be code for networking again.
type OrbEntity ¶
type OrbEntity struct { BaseEntity // contains filtered or unexported fields }
func NewOrbEntity ¶
type PhysicsObject ¶
type PhysicsObject struct {
// X and Y position in the world.
X, Y float64
// This is a bad, but I need collision offsets.
OffsetX, OffsetY float64
// contains filtered or unexported fields
}
func SplitVectorByDegree ¶
func SplitVectorByDegree(spreadArc, vX, vY float64, num int) (vectors []PhysicsObject)
Returns a list of length num populated with vectors that span the given spread centered about vX and vY
func (*PhysicsObject) GetMagneticAffect ¶
func (p *PhysicsObject) GetMagneticAffect(polarity data.Polarity, magnitude float64) float64
Retrieve the strength of the magnetic field based on distance to target
func (*PhysicsObject) GetMagneticVector ¶
func (p *PhysicsObject) GetMagneticVector(t PhysicsObject) (float64, float64)
Retrieve the attractive/repulsive/neutral vector
type PlaySoundRequest ¶
type PlaySoundRequest struct {
Sound string `json:"s"`
}
func (PlaySoundRequest) Type ¶
func (r PlaySoundRequest) Type() net.TypedMessageType
type Player ¶
type Player struct { // Local bool // entity is the player-controlled entity. Entity Entity // I suppose the toolbelt should be here. Toolbelt Toolbelt // ReadyForWave means the players are done building and ready to start the waves. ReadyForWave bool // Name is acquired from the initial connection name. Name string // HoveringPlacement bool HoveringPlace EntityActionPlace HoverColumn, HoverRow int // X and Y hover coordinate in terms of columns/rows // Current points the player has. Points int }
Player represents a player that controls an entity. It handles input and makes the entity dance.
type PointsSync ¶
func (PointsSync) Type ¶
func (r PointsSync) Type() net.TypedMessageType
type PostGameMode ¶
type PostGameMode struct {
// contains filtered or unexported fields
}
PostGameMode is... the final victory...?
func (*PostGameMode) Draw ¶
func (m *PostGameMode) Draw(w *World, screen *ebiten.Image)
func (*PostGameMode) Init ¶
func (m *PostGameMode) Init(w *World) error
func (*PostGameMode) Local ¶
func (m *PostGameMode) Local() bool
func (PostGameMode) String ¶
func (m PostGameMode) String() string
func (PostGameMode) Type ¶
func (m PostGameMode) Type() net.TypedMessageType
type PreGameMode ¶
type PreGameMode struct {
// contains filtered or unexported fields
}
PreGame leads to Build mode.
func (*PreGameMode) Draw ¶
func (m *PreGameMode) Draw(w *World, screen *ebiten.Image)
func (*PreGameMode) Init ¶
func (m *PreGameMode) Init(w *World) error
func (*PreGameMode) Local ¶
func (m *PreGameMode) Local() bool
func (PreGameMode) String ¶
func (m PreGameMode) String() string
func (PreGameMode) Type ¶
func (m PreGameMode) Type() net.TypedMessageType
type ProgressBar ¶
type ProgressBar struct {
// contains filtered or unexported fields
}
func NewProgressBar ¶
func NewProgressBar(width, height int, barColor color.RGBA) *ProgressBar
func (*ProgressBar) Draw ¶
func (pb *ProgressBar) Draw(screen *ebiten.Image, screenOp *ebiten.DrawImageOptions)
func (*ProgressBar) Update ¶
func (pb *ProgressBar) Update()
type ProjecticleEntity ¶
type ProjecticleEntity struct { BaseEntity // contains filtered or unexported fields }
func NewProjecticleEntity ¶
func NewProjecticleEntity() *ProjecticleEntity
func (*ProjecticleEntity) Draw ¶
func (e *ProjecticleEntity) Draw(screen *ebiten.Image, screenOp *ebiten.DrawImageOptions)
func (*ProjecticleEntity) IsProjectile ¶
func (e *ProjecticleEntity) IsProjectile() bool
type Request ¶
type Request interface {
Type() net.TypedMessageType
}
Request represents results from an entity's action completion.
type SelectToolbeltItemRequest ¶
type SelectToolbeltItemRequest struct {
// contains filtered or unexported fields
}
SelectToolbeltItemRequest selects a given toolbelt item
func (SelectToolbeltItemRequest) Type ¶
func (r SelectToolbeltItemRequest) Type() net.TypedMessageType
type SpawnEnemyRequest ¶
type SpawnEnemyRequest struct { X float64 Y float64 Polarity data.Polarity `json:"p"` Kind string `json:"k"` NetID int `json:"i"` // contains filtered or unexported fields }
func (SpawnEnemyRequest) Type ¶
func (r SpawnEnemyRequest) Type() net.TypedMessageType
type SpawnOrbRequest ¶
func (SpawnOrbRequest) Type ¶
func (r SpawnOrbRequest) Type() net.TypedMessageType
type SpawnProjecticleRequest ¶
type SpawnProjecticleRequest struct {
X, Y float64 // Position
NetID int `json:"i"`
VX, VY float64
Polarity data.Polarity `json:"p"`
Damage int `json:"d"`
// contains filtered or unexported fields
}
SpawnProjecticleRequest attempts to spawn a projecticle at given location with given direction
func (SpawnProjecticleRequest) Type ¶
func (r SpawnProjecticleRequest) Type() net.TypedMessageType
type SpawnToolEntityRequest ¶
type SpawnToolEntityRequest struct {
X, Y int
Tool ToolKind `json:"t"`
Kind string `json:"k"`
Polarity data.Polarity `json:"p"`
NetID int `json:"i"`
}
SpawnToolEntityRequest is used to tell the client to spawn an entity tied to a tool.
func (SpawnToolEntityRequest) Type ¶
func (r SpawnToolEntityRequest) Type() net.TypedMessageType
type SpawnerEntity ¶
type SpawnerEntity struct { BaseEntity // contains filtered or unexported fields }
func NewSpawnerEntity ¶
func NewSpawnerEntity(p data.Polarity) *SpawnerEntity
func (*SpawnerEntity) CanPathfind ¶
func (e *SpawnerEntity) CanPathfind() bool
func (*SpawnerEntity) Draw ¶
func (e *SpawnerEntity) Draw(screen *ebiten.Image, screenOp *ebiten.DrawImageOptions)
func (*SpawnerEntity) SetSteps ¶
func (e *SpawnerEntity) SetSteps(s []pathing.Step)
type StartModeRequest ¶
type StartModeRequest struct { }
func (StartModeRequest) Type ¶
func (r StartModeRequest) Type() net.TypedMessageType
type Toolbelt ¶
type Toolbelt struct {
// contains filtered or unexported fields
}
Toolbelt is the interface for containing user actions for placing turrets and similar.
func (*Toolbelt) ActivateItem ¶
func (t *Toolbelt) ActivateItem(item *ToolbeltItem)
func (*Toolbelt) Position ¶
func (t *Toolbelt) Position()
Position positions the toolbelt and all its tools.
func (*Toolbelt) ScrollItem ¶
type ToolbeltItem ¶
type ToolbeltItem struct {
// contains filtered or unexported fields
}
ToolbeltItem is a toolbelt entry.
func (*ToolbeltItem) Cycle ¶
func (t *ToolbeltItem) Cycle()
Cycles through available selections for the toolbelt item
func (*ToolbeltItem) Draw ¶
func (t *ToolbeltItem) Draw(screen *ebiten.Image)
func (*ToolbeltItem) DrawSlot ¶
func (t *ToolbeltItem) DrawSlot(screen *ebiten.Image)
func (*ToolbeltItem) Position ¶
func (t *ToolbeltItem) Position(sx, sy *int)
Position assigns the center position for the toolbelt item.
func (*ToolbeltItem) Update ¶
func (t *ToolbeltItem) Update() (request Request)
type TouchContainer ¶
type TouchContainer struct {
// contains filtered or unexported fields
}
type TrashEntityRequest ¶
type TrashEntityRequest struct { NetID int `json:"i"` // contains filtered or unexported fields }
TrashEntityRequest is send from the server to client(s) to let them know to delete the given entity.
func (TrashEntityRequest) Type ¶
func (r TrashEntityRequest) Type() net.TypedMessageType
type Turret ¶
type Turret struct {
// contains filtered or unexported fields
}
type TurretBeamEntity ¶
type TurretBeamEntity struct { TurretEntity // contains filtered or unexported fields }
func NewTurretBeamEntity ¶
func NewTurretBeamEntity(config data.EntityConfig) *TurretBeamEntity
func (*TurretBeamEntity) AcquireTarget ¶
func (e *TurretBeamEntity) AcquireTarget(world *World)
Finds the closest entity of same polarity within attack radius and sets the current target if found.
func (*TurretBeamEntity) Draw ¶
func (e *TurretBeamEntity) Draw(screen *ebiten.Image, screenOp *ebiten.DrawImageOptions)
type TurretEntity ¶
type TurretEntity struct { BaseEntity // contains filtered or unexported fields }
func NewTurretEntity ¶
func NewTurretEntity(config data.EntityConfig) *TurretEntity
func (*TurretEntity) AcquireTarget ¶
func (e *TurretEntity) AcquireTarget(world *World)
Finds the closest entity within attack radius and sets the current target if found
func (*TurretEntity) Draw ¶
func (e *TurretEntity) Draw(screen *ebiten.Image, screenOp *ebiten.DrawImageOptions)
type UseToolRequest ¶
type UseToolRequest struct {
X, Y int
Tool ToolKind `json:"t"`
Kind string `json:"k"`
Polarity data.Polarity `json:"p"`
NetID int `json:"i"` // Yeah, yeah, we shouldn't have NetID here, but it's easier to reuse UseToolRequest rather than implement some new SpawnTurret/SpawnWall/RemoveWall Request set.
Owner string `json:"o"` // The owner's name. This is a little excessive to send, but it's easier than mucking about with client/server index checking. Also enables more players if we ever want that.
// contains filtered or unexported fields
}
UseToolRequest attempts to use the tool at a given cell.
func (UseToolRequest) Type ¶
func (r UseToolRequest) Type() net.TypedMessageType
type VictoryMode ¶
type VictoryMode struct {
// contains filtered or unexported fields
}
VictoryMode represents when all waves are finished. Leads to Travel state.
func (*VictoryMode) Draw ¶
func (m *VictoryMode) Draw(w *World, screen *ebiten.Image)
func (*VictoryMode) Init ¶
func (m *VictoryMode) Init(w *World) error
func (*VictoryMode) Local ¶
func (m *VictoryMode) Local() bool
func (VictoryMode) String ¶
func (m VictoryMode) String() string
func (VictoryMode) Type ¶
func (m VictoryMode) Type() net.TypedMessageType
type WallEntity ¶
type WallEntity struct { BaseEntity // contains filtered or unexported fields }
func NewWallEntity ¶
func NewWallEntity() *WallEntity
func (*WallEntity) Draw ¶
func (e *WallEntity) Draw(screen *ebiten.Image, screenOp *ebiten.DrawImageOptions)
type WaveMode ¶
type WaveMode struct {
// contains filtered or unexported fields
}
WaveMode leads to Wave, Loss, Victory, or PostGame.
func (WaveMode) Type ¶
func (m WaveMode) Type() net.TypedMessageType
type World ¶
type World struct { Game Game // Ewwww x2 Mode WorldMode CameraX, CameraY float64 CurrentWave int MaxWave int // Overall game speed Speed float64 // contains filtered or unexported fields }
World is a struct for our cells and entities.
func (*World) AreCoresDead ¶
AreCoresDead returns true if all cores are dead.
func (*World) AreEnemiesDead ¶
func (*World) ArePlayersReady ¶
ArePlayersReady returns true if all players are ready to start.
func (*World) AreWavesComplete ¶
func (*World) BuildFromLevel ¶
BuildFromLevel builds the world's cells and entities from a given base level.
func (*World) CollectOrb ¶
func (w *World) CollectOrb(r CollectOrbRequest)
func (*World) DamageCore ¶
func (w *World) DamageCore(r DamageCoreRequest)
func (*World) GetCursorPosition ¶
GetCursorPosition returns the cursor position relative to the map.
func (*World) GetNextNetID ¶
func (*World) IsPlacementValid ¶
func (*World) PlaceEntityAt ¶
PlaceEntityAt places the entity into the world at the given specific coordinates.
func (*World) PlaceEntityInCell ¶
PlaceEntity places the entity into the world, aligned by cell and centered within a cell.
func (*World) ProcessRequest ¶
func (*World) SendPlayerPoints ¶
func (w *World) SendPlayerPoints()
func (*World) SetMode ¶
SetMode sets the current game mode to the one indicated. If we're a client and the mode set is local, this does nothing.
func (*World) SpawnEnemyEntity ¶
func (w *World) SpawnEnemyEntity(r SpawnEnemyRequest) *EnemyEntity
func (*World) SpawnOrbEntity ¶
func (w *World) SpawnOrbEntity(r SpawnOrbRequest) *OrbEntity
func (*World) SpawnProjecticleEntity ¶
func (w *World) SpawnProjecticleEntity(r SpawnProjecticleRequest) *ProjecticleEntity
func (*World) SplitPoints ¶
func (*World) SyncEntity ¶
func (w *World) SyncEntity(r EntityPropertySync)
func (*World) SyncPoints ¶
func (w *World) SyncPoints(r PointsSync)
SyncPoints synchronizes the players' points to match the provided data.