world

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Feb 1, 2023 License: AGPL-3.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultTPS = 60

	DefaultScreenWidth  = 1280
	DefaultScreenHeight = 720

	InternalScreenWidth, InternalScreenHeight = 854, 480

	Gravity = 3

	JumpVelocity = 20

	GroundWidth  = 600
	GroundHeight = 100

	MaxDebug = 2
)

Variables

View Source
var (
	TPS = DefaultTPS

	Fullscreen   bool
	DisableVsync bool
	Headless     bool // Run without using the display

	ScreenWidth, ScreenHeight = 0, 0

	CamX, CamY = 0, 0 // TODO currently static

	StartMuted bool // Start with music muted.

	LocalPort int

	ConnectPromptVisible   = true // When false, we are connected
	ConnectPromptText      string
	ConnectPromptHost      bool
	ConnectPromptConfirmed bool
	ConnectionActive       bool

	Debug int

	WASM bool

	CurrentPlayer = 1

	Local bool   // Playing against computer
	AI    AIType // AI configuration

	Backend ggpo.Backend
)
View Source
var (
	Player1 component.Player
	Player2 component.Player
	Winner  int
)

These variables are cached to prevent race conditions.

View Source
var PhysicsRects = []image.Rectangle{
	image.Rect(-GroundWidth/2, 0, GroundWidth/2, -GroundHeight),
}
View Source
var TPSPresets = []int{1, 2, 4, 10, 30, 60, 120}

Functions

func FloatRect

func FloatRect(x1, y1, x2, y2 float64) image.Rectangle

func GameCoordsToScreen

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

func GameRectToScreen

func GameRectToScreen(r image.Rectangle) image.Rectangle

Types

type AIType

type AIType int
const (
	AIStandard AIType = iota
	AINone
	AIMirror
	AIBlock
)

Jump to

Keyboard shortcuts

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