world

package
v1.1.0 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: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ScreenWidth  = 960
	ScreenHeight = 540
)
View Source
const (
	PlayerWidth  = 15.0
	PlayerHeight = 23.0
)
View Source
const (
	MagnetizeDown = iota
	MagnetizeDownLeft
	MagnetizeLeft
	MagnetizeUpLeft
	MagnetizeUp
	MagnetizeUpRight
	MagnetizeRight
	MagnetizeDownRight
)
View Source
const (
	LayerDefault = 0 - iota
	LayerDecorationAbove
	LayerPlayer
	LayerDecorationBelow
	LayerPlatform
)
View Source
const (
	TriggerJump = iota + 1
	TriggerMagnetize
	TriggerFire
	TriggerSwitch
	TriggerData
)
View Source
const Gravity = 500.0
View Source
const TPS = 144
View Source
const (
	TileScreenOff = 395
)
View Source
const TileSize = 16

Variables

View Source
var (
	Debug int

	// Give is a list of abilities the player is given at the start of the game.
	// This is only available to users as a commandline flag.
	Give string

	// DisableEsc is set to true when the escape key should not exit the game.
	// This is used on WASM builds, where users exit the game by closing the tab.
	DisableEsc bool

	Map *tiled.Map

	TileImages = make(map[uint32]*ebiten.Image)

	ObjectGroups []*tiled.ObjectGroup

	GameOver bool

	ResetGame bool

	ShownIntro bool

	Player gohan.Entity

	CamX, CamY float64

	CamTargetX, CamTargetY float64

	SpawnX, SpawnY float64

	MetalRects []image.Rectangle

	PlayerGrounded bool

	MagnetActive    bool
	MagnetDirection int // 0 down, 1 left, 2 up, 3 right

	PlayerDirection int

	Clinging bool

	LastWalkDirL, LastWalkDirU bool

	HazardRects []image.Rectangle

	Space *cp.Space

	PlayerShape *cp.Shape
	PlayerBody  *cp.Body

	PlayerNormal cp.Vector

	PlayerIdleFrames []*ebiten.Image
	PlayerWalkFrames []*ebiten.Image

	CollisionShapes []*cp.Shape

	TriggerRects    []image.Rectangle
	TriggerActions  []TriggerAction
	TriggerEntities []gohan.Entity

	DataRect image.Rectangle

	CanJump       bool
	CanMagnetize  bool
	CanFire       bool
	CanDoubleJump bool

	LastFire int

	MessageText    string
	MessageUpdated bool

	RemoveTrigger = -1

	Tick int

	StartMuted bool

	DestructibleRects    []image.Rectangle
	DestructibleEntities []gohan.Entity
	DestructibleShapes   [][]*cp.Shape

	BeamRects    []image.Rectangle
	BeamShapes   [][]*cp.Shape
	BeamEntities []gohan.Entity

	GameOverTicks int
)

Functions

func BBToLevelRect

func BBToLevelRect(bb cp.BB) image.Rectangle

func BBToScreenRect

func BBToScreenRect(bb cp.BB) image.Rectangle

func LevelCoordinatesToScreen

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

func OpenSwitch

func OpenSwitch()

func SetMessage

func SetMessage(message string)

Types

type TriggerAction

type TriggerAction int

Jump to

Keyboard shortcuts

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