Documentation ¶
Index ¶
- Constants
- Variables
- func AltButtonAt(x, y int) int
- func CartesianToIso(x, y float64) (float64, float64)
- func Date() (month string, year string)
- func Demand() (r, c, i float64)
- func DrawMap(structureType int) *ebiten.Image
- func HandleRCIWindow(x, y int) bool
- func HelpButtonAt(x, y int) int
- func IsPowerPlant(structureType int) bool
- func IsZone(structureType int) bool
- func IsoToCartesian(x, y float64) (float64, float64)
- func IsoToScreen(x, y float64) (float64, float64)
- func LevelCoordinatesToScreen(x, y float64) (float64, float64)
- func LoadMap(structureType int) (*tiled.Map, error)
- func LoadTileset() error
- func ObjectToRect(o *tiled.Object) image.Rectangle
- func PlayNextSong()
- func Population() (r, c, i int)
- func Reset()
- func ResetPowerOuts()
- func ResumeSong()
- func Satisfaction() (r, c, i float64)
- func ScreenToCartesian(x, y int) (float64, float64)
- func ScreenToIso(x, y int) (float64, float64)
- func SetHelpPage(page int)
- func SetHoverStructure(structureType int)
- func ShowBuildCost(structureType int, cost int)
- func ShowMessage(message string, duration int)
- func StartGame()
- func TargetPopulation() (r, c, i int)
- func TickMessages()
- func Tooltip() string
- func ValidXY(x, y int) bool
- type GameLevel
- type GameWorld
- type HUDButton
- type PowerMap
- type PowerMapTile
- func (t *PowerMapTile) Down() *PowerMapTile
- func (t *PowerMapTile) Left() *PowerMapTile
- func (t *PowerMapTile) PathEstimatedCost(to astar.Pather) float64
- func (t *PowerMapTile) PathNeighborCost(to astar.Pather) float64
- func (t *PowerMapTile) PathNeighbors() []astar.Pather
- func (t *PowerMapTile) Right() *PowerMapTile
- func (t *PowerMapTile) Up() *PowerMapTile
- type PowerPlant
- type Structure
- type Tile
- type Zone
Constants ¶
View Source
const ( StructureToggleHelp = iota + 1 StructureToggleTransparentStructures StructureBulldozer StructureRoad StructureResidentialZone StructureResidentialLow StructureResidentialMedium StructureResidentialHigh StructureCommercialZone StructureCommercialLow StructureCommercialMedium StructureCommercialHigh StructureIndustrialZone StructureIndustrialLow StructureIndustrialMedium StructureIndustrialHigh StructurePoliceStation StructurePowerPlantCoal StructurePowerPlantSolar StructurePowerPlantNuclear )
View Source
const ( MonthTicks = 144 * 5 YearTicks = MonthTicks * 12 )
View Source
const SidebarWidth = 199
View Source
const TileSize = 64
Variables ¶
View Source
var ( GrassTile = uint32(11*32 + (0)) TreeTileA = uint32(5*32 + (24)) TreeTileB = uint32(5*32 + (25)) )
View Source
var CameraMaxZoom = 1.0
View Source
var CameraMinZoom = 0.1
View Source
var DirtTile = uint32(9*32 + (0))
View Source
var ErrNothingToBulldoze = errors.New("nothing to bulldoze")
View Source
var HUDButtons []*HUDButton
View Source
var HelpText = []string{`
Welcome to City Limits! (1/10)
As the new mayor, it's time to run
things YOUR way. For better or worse...
Will you lead the clean energy front,
or will you put profits before people?
`, `
Moving Via Mouse (2/10)
To move around, press and hold your
middle mouse button while moving your
mouse, or press right click to center
the camera on an area immediately.
`, `
Moving Via Keyboard (3/10)
You can also use your keyboard to move
by pressing any of the arrow keys or
W/A/S/D. Try using your mouse and/or
keyboard to move the camera around now.
`, `
Zoning Areas (4/10)
Structures are built according to how
you zone areas of land. Demand for each
category (Residential, Commercial,
Industrial) is shown in the sidebar.
`, `
Did You Know? (5/10)
Powering an area requires more input
energy than the resulting electricity.
In fact, only a third of the energy is
transmitted as usable electricity.
`, `
Building Blocks of a City (6/10)
Structures require power, sewer and
transportation in order to function.
This is all facilitated via roads and
underground wiring and piping.
`, `
Did You Know? (7/10)
Meat-based diets require much more
energy, land and water resources than
vegetarian and especially vegan diets.
Animal farms are a source of pollution.
`, `
Power to the People (8/10)
Build a power plant, then zone a few
areas for residential development.
Connect the power plant to the newly
zoned areas with a road.
`, `
Did You Know? (9/10)
It takes large amounts of water to
convert fossil fuels into electricity.
Converting solar and wind energy uses
negligible amounts of water.
`, `
Collecting Taxes (10/10)
Each year, taxes are collected from the
residents of the city. The tax rate you
set determines how appealing your city
is, and whether or not it can survive.
`,
}
HelpText lines must be 39 characters or less.
View Source
var PowerPlantCapacities = map[int]int{
StructurePowerPlantCoal: 60,
StructurePowerPlantSolar: 40,
StructurePowerPlantNuclear: 200,
}
View Source
var StructureCosts = map[int]int{
StructureBulldozer: 5,
StructureRoad: 25,
StructurePoliceStation: 1000,
StructurePowerPlantCoal: 4000,
StructurePowerPlantSolar: 10000,
StructurePowerPlantNuclear: 25000,
StructureResidentialZone: 100,
StructureCommercialZone: 200,
StructureIndustrialZone: 100,
}
View Source
var StructureFilePaths = map[int]string{ StructureBulldozer: "map/bulldozer.tmx", StructureRoad: "map/road.tmx", StructureResidentialZone: "map/residential_zone.tmx", StructureResidentialLow: "map/residential_low1.tmx", StructureResidentialMedium: "map/residential_med1.tmx", StructureResidentialHigh: "map/residential_high1.tmx", StructureCommercialZone: "map/commercial_zone.tmx", StructureCommercialLow: "map/commercial_low1.tmx", StructureCommercialMedium: "map/commercial_med1.tmx", StructureCommercialHigh: "map/commercial_high1.tmx", StructureIndustrialZone: "map/industrial_zone.tmx", StructureIndustrialLow: "map/industrial_low1.tmx", StructureIndustrialMedium: "map/industrial_med1.tmx", StructureIndustrialHigh: "map/industrial_high1.tmx", StructurePoliceStation: "map/policestation.tmx", StructurePowerPlantCoal: "map/power_coal.tmx", StructurePowerPlantSolar: "map/power_solar.tmx", StructurePowerPlantNuclear: "map/power_nuclear.tmx", }
View Source
var StructureTooltips = map[int]string{
StructureToggleHelp: "Help",
StructureToggleTransparentStructures: "Transparent buildings",
StructureBulldozer: "Bulldozer",
StructureRoad: "Road",
StructurePoliceStation: "Police station",
StructurePowerPlantCoal: "Coal power plant",
StructurePowerPlantSolar: "Solar power plant",
StructurePowerPlantNuclear: "Nuclear plant",
StructureResidentialZone: "Residential zone",
StructureCommercialZone: "Commercial zone",
StructureIndustrialZone: "Industrial zone",
}
View Source
var World = &GameWorld{ CamScale: startingZoom, CamScaleTarget: startingZoom, CamMoving: true, PlayerWidth: 8, PlayerHeight: 32, TileImages: make(map[uint32]*ebiten.Image), ResetGame: true, Level: NewLevel(256), Power: newPowerMap(), PowerOuts: newPowerOuts(), TaxR: startingTax, TaxC: startingTax, TaxI: startingTax, BuildDragX: -1, BuildDragY: -1, LastBuildX: -1, LastBuildY: -1, Printer: message.NewPrinter(language.English), }
View Source
var ZonePowerRequirement = map[int]int{
StructureResidentialZone: 1,
StructureCommercialZone: 1,
StructureIndustrialZone: 1,
}
Functions ¶
func AltButtonAt ¶
func CartesianToIso ¶
CartesianToIso transforms cartesian coordinates into isometric coordinates.
func HandleRCIWindow ¶ added in v1.1.0
func HelpButtonAt ¶
func IsPowerPlant ¶
func IsoToCartesian ¶
CartesianToIso transforms cartesian coordinates into isometric coordinates.
func IsoToScreen ¶
func LoadTileset ¶
func LoadTileset() error
func ObjectToRect ¶
func PlayNextSong ¶ added in v1.1.0
func PlayNextSong()
func Population ¶
func Population() (r, c, i int)
func ResetPowerOuts ¶
func ResetPowerOuts()
func ResumeSong ¶ added in v1.1.0
func ResumeSong()
func Satisfaction ¶
func Satisfaction() (r, c, i float64)
func ScreenToCartesian ¶
func ScreenToIso ¶
func SetHelpPage ¶
func SetHelpPage(page int)
func SetHoverStructure ¶
func SetHoverStructure(structureType int)
func ShowBuildCost ¶
func ShowMessage ¶
func TargetPopulation ¶
func TargetPopulation() (r, c, i int)
func TickMessages ¶
func TickMessages()
Types ¶
type GameLevel ¶
type GameLevel struct { Tiles [][][]*Tile // contains filtered or unexported fields }
func (*GameLevel) ClearHoverSprites ¶
func (l *GameLevel) ClearHoverSprites()
type GameWorld ¶
type GameWorld struct { Level *GameLevel Player gohan.Entity ScreenW, ScreenH int DisableEsc bool Debug int NoClip bool GameStarted bool GameStartedTicks int GameOver bool PlayerX, PlayerY float64 CamX, CamY float64 CamScale float64 CamScaleTarget float64 CamMoving bool PlayerWidth float64 PlayerHeight float64 HoverStructure int HoverX, HoverY int HoverLastX, HoverLastY int HoverValid bool Map *tiled.Map ObjectGroups []*tiled.ObjectGroup HazardRects []image.Rectangle CreepRects []image.Rectangle CreepEntities []gohan.Entity TriggerEntities []gohan.Entity TriggerRects []image.Rectangle TriggerNames []string NativeResolution bool BrokenPieceA, BrokenPieceB gohan.Entity TileImages map[uint32]*ebiten.Image TileImagesFirstGID uint32 ResetGame bool MuteMusic bool MuteSoundEffects bool // TODO GotCursorPosition bool EnvironmentSprites int SelectedStructure *Structure HUDUpdated bool HUDButtonRects []image.Rectangle RCIButtonRect image.Rectangle RCIWindowRect image.Rectangle ShowRCIWindow bool HelpUpdated bool HelpPage int HelpButtonRects []image.Rectangle PowerPlants []*PowerPlant Zones []*Zone HavePowerOut bool PowerOuts [][]bool Ticks int Paused bool Funds int Printer *message.Printer TransparentStructures bool Messages []string MessagesTicks []int Power PowerMap PowerUpdated bool PowerAvailable int PowerNeeded int BuildDragX int BuildDragY int LastBuildX int LastBuildY int TaxR float64 TaxC float64 TaxI float64 // contains filtered or unexported fields }
func (*GameWorld) SetGameOver ¶
type HUDButton ¶
type HUDButton struct { Sprite *ebiten.Image SpriteOffsetX, SpriteOffsetY float64 Label string StructureType int }
func HUDButtonAt ¶
type PowerMap ¶
type PowerMap [][]*PowerMapTile
func (PowerMap) GetTile ¶
func (m PowerMap) GetTile(x, y int) *PowerMapTile
type PowerMapTile ¶
type PowerMapTile struct { X int Y int CarriesPower bool // Set to true for roads and all building tiles (even power plants) }
func (*PowerMapTile) Down ¶
func (t *PowerMapTile) Down() *PowerMapTile
func (*PowerMapTile) Left ¶
func (t *PowerMapTile) Left() *PowerMapTile
func (*PowerMapTile) PathEstimatedCost ¶
func (t *PowerMapTile) PathEstimatedCost(to astar.Pather) float64
func (*PowerMapTile) PathNeighborCost ¶
func (t *PowerMapTile) PathNeighborCost(to astar.Pather) float64
func (*PowerMapTile) PathNeighbors ¶
func (t *PowerMapTile) PathNeighbors() []astar.Pather
func (*PowerMapTile) Right ¶
func (t *PowerMapTile) Right() *PowerMapTile
func (*PowerMapTile) Up ¶
func (t *PowerMapTile) Up() *PowerMapTile
type PowerPlant ¶
Click to show internal directories.
Click to hide internal directories.