world

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Dec 30, 2021 License: GPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var World = &GameWorld{
	CamScale:     1,
	CamMoving:    true,
	PlayerWidth:  8,
	PlayerHeight: 32,
	TileImages:   make(map[uint32]*ebiten.Image),
	ResetGame:    true,
}

Functions

func LevelCoordinatesToScreen

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

func LoadMap

func LoadMap(filePath string)

func NewCreep

func NewCreep(creepType int, creepID int64, x float64, y float64) gohan.Entity

TODO move

func ObjectToRect

func ObjectToRect(o *tiled.Object) image.Rectangle

func Reset

func Reset()

func SetMessage

func SetMessage(message string, duration int)

func StartGame

func StartGame()

func TileToGameCoords

func TileToGameCoords(x, y int) (float64, float64)

Types

type GameWorld

type GameWorld struct {
	*gohan.World

	Player gohan.Entity

	ScreenW, ScreenH int

	DisableEsc bool

	Debug  int
	NoClip 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

	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

	ResetGame bool
	// contains filtered or unexported fields
}

func (*GameWorld) SetGameOver

func (w *GameWorld) SetGameOver(vx, vy float64)

Jump to

Keyboard shortcuts

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