Documentation ¶
Index ¶
- Constants
- Variables
- type Block
- type BlockColor
- type BlockState
- type Board
- type BoardState
- type Cell
- type Game
- type GameState
- type HUD
- type HUDItem
- type Marker
- type MarkerState
- type Menu
- type MenuChoiceID
- type MenuID
- type MenuItem
- type MenuItemID
- type MenuSelector
- type MenuSlider
- type Ring
- type Selector
- type SelectorState
Constants ¶
View Source
const (
SecPerUpdate = 1.0 / updatesPerSec
)
Variables ¶
View Source
var HUDItemText = [...]string{ HUDItemSpeed: "S P E E D", HUDItemTime: "T I M E", HUDItemScore: "S C O R E", }
View Source
var MenuChoiceText = map[MenuChoiceID]string{ MenuEasy: "E A S Y", MenuMedium: "M E D I U M", MenuHard: "H A R D", }
View Source
var MenuItemText = map[MenuItemID]string{ MenuNewGameItem: "N E W G A M E", MenuStats: "S T A T S", MenuOptions: "O P T I O N S", MenuCredits: "C R E D I T S", MenuExit: "E X I T", MenuSpeed: "S P E E D", MenuDifficulty: "D I F F I C U L T Y", MenuOK: "O K", MenuContinueGame: "C O N T I N U E G A M E", MenuQuit: "Q U I T", }
View Source
var MenuTitleText = map[MenuID]string{ MenuMain: "b l o c k c i l l i n", MenuNewGame: "N E W G A M E", MenuPaused: "P A U S E D", MenuGameOver: "G A M E O V E R", }
Functions ¶
This section is empty.
Types ¶
type Block ¶
type Block struct { // State is the block's state. State BlockState // Color is the block's color. Red by default. Color BlockColor // Dropping is set when a block is dropping and has been for at least one ring. Dropping bool // contains filtered or unexported fields }
Block is a block that can be put into a cell.
func (*Block) StateProgress ¶
type BlockColor ¶
type BlockColor int32
const ( Red BlockColor = iota Purple Blue Cyan Green Yellow )
func (BlockColor) String ¶
func (i BlockColor) String() string
type BlockState ¶
type BlockState int32
const ( // BlockStatic is a visible and stationary block. BlockStatic BlockState = iota // BlockSwappingFromLeft is a visible block swapping from the left. BlockSwappingFromLeft // BlockSwappingFromRight is a visible block swapping from the right. BlockSwappingFromRight // BlockDroppingFromAbove is a visible block dropping from above. BlockDroppingFromAbove // BlockFlashing is a block within a chain that is flashing. // Automatically goes to the BlockCracking state. BlockFlashing // BlockCracking is a block within a chain that is cracking. // Automatically goes to the BlockCracked state. BlockCracking // BlockCracked is a block within a chain has finished cracking. // Manually change the state to BlockExploding when ready. BlockCracked // BlockExploding is a block within a chain that is exploding. // Automatically goes to the BlockExploded state. BlockExploding // BlockExploded is a block within a chain that has finished exploding. // Manually change the state to BlockClearPausing when ready. BlockExploded // BlockClearPausing is an invisible block but cannot be dropped into yet. // Automatically goes to the BlockCleared state. BlockClearPausing // BlockCleared is a an invisible block. BlockCleared )
func (BlockState) String ¶
func (i BlockState) String() string
type Board ¶
type Board struct { // State is the board's state. Use only within this file. State BoardState // Rings are the rings with cells with blocks that the player can swap. Rings []*Ring // SpareRings are additional upcoming rings that the user cannot swap yet. SpareRings []*Ring // RingCount is how many rings the board has. RingCount int // CellCount is the fixed number of cells each ring can have. CellCount int // Selector is the selector the player uses to swap blocks. Selector *Selector // Y is vertical offset from 0 to 1 as the board rises one ring. Y float32 // contains filtered or unexported fields }
func (*Board) RiseProgress ¶
func (*Board) StateProgress ¶
type BoardState ¶
type BoardState int32
const ( BoardEntering BoardState = iota BoardLive BoardGameOver BoardExiting )
func (BoardState) String ¶
func (i BoardState) String() string
type Game ¶
type Game struct { State GameState Menu *Menu Board *Board HUD *HUD // GlobalPulse is incremented each update so it can be used for any pulsing animation. GlobalPulse float32 // contains filtered or unexported fields }
func (*Game) StateProgress ¶
type Marker ¶
type Marker struct { State MarkerState ComboLevel int ChainLevel int // contains filtered or unexported fields }
func (*Marker) StateProgress ¶
type MarkerState ¶
type MarkerState int32
const ( // MarkerNone is an empty marker. MarkerNone MarkerState = iota // MarkeShowing is a marker being shown. MarkerShowing )
func (MarkerState) String ¶
func (i MarkerState) String() string
type MenuChoiceID ¶
type MenuChoiceID byte
const ( MenuEasy MenuChoiceID = iota MenuMedium MenuHard )
func (MenuChoiceID) String ¶
func (i MenuChoiceID) String() string
type MenuItem ¶
type MenuItem struct { ID MenuItemID Selector *MenuSelector Slider *MenuSlider }
func (*MenuItem) SingleChoice ¶
type MenuItemID ¶
type MenuItemID byte
const ( MenuNewGameItem MenuItemID = iota MenuStats MenuOptions MenuCredits MenuExit MenuSpeed MenuDifficulty MenuOK MenuContinueGame MenuQuit )
func (MenuItemID) String ¶
func (i MenuItemID) String() string
type MenuSelector ¶
type MenuSelector struct { Choices []MenuChoiceID // contains filtered or unexported fields }
func (*MenuSelector) Value ¶
func (s *MenuSelector) Value() MenuChoiceID
type MenuSlider ¶
type Selector ¶
type Selector struct { // State is the state of the selector. State SelectorState // X is the selector's current column. // It changes only after the move animation completes. X int // Y is the selector's current row. // It changes only after the move animation completes. Y int // Pulse is used to pulse the selector only when it is moving. Pulse float32 // contains filtered or unexported fields }
func (*Selector) StateProgress ¶
type SelectorState ¶
type SelectorState int32
const ( SelectorStatic SelectorState = iota SelectorMovingUp SelectorMovingDown SelectorMovingLeft SelectorMovingRight )
func (SelectorState) String ¶
func (i SelectorState) String() string
Source Files ¶
Click to show internal directories.
Click to hide internal directories.