
The highest tagged major version is
v2.
package
Version:
v1.9.2
Opens a new window with list of versions in this module.
Published: Apr 28, 2019
License: Apache-2.0
Opens a new window with license information.
Imports: 13
Opens a new window with list of imports.
Imported by: 0
Opens a new window with list of known importers.
Documentation
¶
View Source
const (
ScreenWidth = 420
ScreenHeight = 600
)
MoveTiles moves tiles in the given tiles map if possible.
MoveTiles returns true if there are tiles that are to move, otherwise false.
When MoveTiles is called, all tiles must not be about to move.
Board represents the game board.
NewBoard generates a new Board with giving a size.
Draw draws the board to the given boardImage.
Move enqueues tile moving tasks.
Size returns the board size.
Update updates the board state.
Dir represents a direction.
const (
DirUp Dir = iota
DirRight
DirDown
DirLeft
)
String returns a string representing the direction.
func (d Dir) Vector() (x, y int)
Vector returns a [-1, 1] value for each axis.
Game represents a game state.
NewGame generates a new Game object.
Draw draws the current game to the given screen.
Update updates the current game state.
Input represents the current key states.
NewInput generates a new Input object.
Dir returns a currently pressed direction.
Dir returns false if no direction key is pressed.
Update updates the current input states.
Tile represents a tile information including TileData and animation states.
NewTile creates a new Tile object.
Draw draws the current tile to the given boardImage.
IsMoving returns a boolean value indicating if the tile is animating.
NextPos returns the tile's next position.
NextPos is used only at testing so far.
NextValue returns the tile's current value.
NextValue is used only at testing so far.
Pos returns the tile's current position.
Pos is used only at testing so far.
Update updates the tile's animation states.
Value returns the tile's current value.
Value is used only at testing so far.
TileData represents a tile information like a value and a position.
Source Files
¶
Click to show internal directories.
Click to hide internal directories.