world

package
v1.0.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 19, 2022 License: AGPL-3.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ScreenWidth  = 400
	ScreenHeight = 225
)
View Source
const (
	StartingRailSpeed = 0.6
	FishSpeedIncrease = 0.05
)
View Source
const SectionWidth = ScreenWidth * 2

Variables

View Source
var RailSpeed = StartingRailSpeed
View Source
var World = &GameWorld{
	CamScale:     1,
	CamMoving:    true,
	PlayerWidth:  16,
	PlayerHeight: 16,
	ResetGame:    true,
}

Functions

func LevelCoordinatesToScreen

func LevelCoordinatesToScreen(x, y float64) (float64, float64)

func LevelUp

func LevelUp()

func MaxCreeps

func MaxCreeps() int

func NeededKills

func NeededKills() int

func Reset

func Reset()

func ScreenToLevelCoordinates

func ScreenToLevelCoordinates(x, y float64) (float64, float64)

func SetFish

func SetFish(fish level.FishType)

func SetMessage

func SetMessage(message string, duration int)

func StartGame

func StartGame()

Types

type GameWorld

type GameWorld struct {
	Player gohan.Entity

	DisableEsc bool

	Debug      int
	StartMuted bool
	NoClip     bool
	GodMode    bool

	GameStarted      bool
	GameStartedTicks int
	GameOver         bool

	MessageVisible  bool
	MessageTicks    int
	MessageDuration int
	MessageUpdated  bool
	MessageText     string

	PlayerX, PlayerY float64

	CamX, CamY float64
	CamScale   float64
	CamMoving  bool

	PlayerWidth  float64
	PlayerHeight float64

	ResetGame bool

	ForceSeed int64

	Tick int

	SectionA      *Section
	SectionB      *Section
	FirstSectionB bool

	Score        int
	ScoreUpdated bool

	Fish         level.FishType
	Kills        int
	NeedKills    int
	LevelUpTicks int

	KillInfoUpdated bool
	// contains filtered or unexported fields
}

func (*GameWorld) SetGameOver

func (w *GameWorld) SetGameOver()

type Section

type Section struct {
	X float64
	Y float64

	Entities []gohan.Entity

	TileOccupied [][]bool

	ShoreDepth int

	Creeps [][]gohan.Entity

	sync.Mutex
}

func NewSection

func NewSection(x, y float64) *Section

func (*Section) Regenerate

func (s *Section) Regenerate(lastShoreDepth int)

func (*Section) SetPosition

func (s *Section) SetPosition(x float64, y float64)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL