platformer

package
v0.0.0-...-942270a Latest Latest
Warning

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

Go to latest
Published: Sep 21, 2024 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ScreenWidth  = 640
	ScreenHeight = 360
)
View Source
const (
	DT          = 0.1
	WINDOWSIZE  = 256
	WINDOWSCALE = 3
	TILESIZE    = 16
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Game

type Game struct {
	// contains filtered or unexported fields
}

func (*Game) Draw

func (g *Game) Draw(screen *ebiten.Image)

func (*Game) Layout

func (g *Game) Layout(outsideWidth, outsideHeight int) (screenWidth, screenHeight int)

func (*Game) Update

func (g *Game) Update() error

type GameScene

type GameScene struct {
	// contains filtered or unexported fields
}

func NewGameScene

func NewGameScene() *GameScene

func (*GameScene) Draw

func (s *GameScene) Draw(screen *ebiten.Image)

func (*GameScene) Update

func (s *GameScene) Update(state *GameState) error

type GameState

type GameState struct {
	SceneManager *SceneManager
	Input        *Input
}

type GamepadScene

type GamepadScene struct {
	// contains filtered or unexported fields
}

func (*GamepadScene) Draw

func (s *GamepadScene) Draw(screen *ebiten.Image)

func (*GamepadScene) Update

func (s *GamepadScene) Update(state *GameState) error

type Input

type Input struct {
	// contains filtered or unexported fields
}

Input manages the input state including gamepads and keyboards.

func (*Input) GamepadIDButtonPressed

func (i *Input) GamepadIDButtonPressed() ebiten.GamepadID

GamepadIDButtonPressed returns a gamepad ID where at least one button is pressed. If no button is pressed, GamepadIDButtonPressed returns -1.

func (*Input) IsRotateLeftJustPressed

func (i *Input) IsRotateLeftJustPressed() bool

func (*Input) IsRotateRightJustPressed

func (i *Input) IsRotateRightJustPressed() bool

func (*Input) StateForDown

func (i *Input) StateForDown() int

func (*Input) StateForLeft

func (i *Input) StateForLeft() int

func (*Input) StateForRight

func (i *Input) StateForRight() int

func (*Input) Update

func (i *Input) Update()

type Player

type Player struct {
	Object         *resolv.Object
	Speed          resolv.Vector
	OnGround       *resolv.Object
	SlidingOnWall  *resolv.Object
	FacingRight    bool
	IgnorePlatform *resolv.Object
}

func NewPlayer

func NewPlayer(space *resolv.Space) *Player

type Scene

type Scene interface {
	Update(state *GameState) error
	Draw(screen *ebiten.Image)
}

type SceneManager

type SceneManager struct {
	// contains filtered or unexported fields
}

func (*SceneManager) Draw

func (s *SceneManager) Draw(r *ebiten.Image)

func (*SceneManager) GoTo

func (s *SceneManager) GoTo(scene Scene)

func (*SceneManager) Update

func (s *SceneManager) Update(input *Input) error

type TitleScene

type TitleScene struct {
	// contains filtered or unexported fields
}

func (*TitleScene) Draw

func (s *TitleScene) Draw(r *ebiten.Image)

func (*TitleScene) Update

func (s *TitleScene) Update(state *GameState) error

type WorldPlatformer

type WorldPlatformer struct {
	Space  *resolv.Space
	Player *Player

	FloatingPlatform      *resolv.Object
	FloatingPlatformTween *gween.Sequence
}

func NewWorldPlatformer

func NewWorldPlatformer() *WorldPlatformer

func (*WorldPlatformer) Draw

func (world *WorldPlatformer) Draw(screen *ebiten.Image)

func (*WorldPlatformer) DrawPolygon

func (world *WorldPlatformer) DrawPolygon(screen *ebiten.Image, polygon *resolv.ConvexPolygon, color color.Color)

func (*WorldPlatformer) Init

func (world *WorldPlatformer) Init()

func (*WorldPlatformer) Update

func (world *WorldPlatformer) Update()

Directories

Path Synopsis
Package ldtkgo is a loader for LDtk projects, written in Golang.
Package ldtkgo is a loader for LDtk projects, written in Golang.
resources

Jump to

Keyboard shortcuts

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