scenes

package
v1.6.7 Latest Latest
Warning

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

Go to latest
Published: Jan 23, 2019 License: GPL-3.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CollisionTypePlayer = 1 << (iota + 1)
	CollisionTypeEnemy
	CollisionTypeWall
)
View Source
const BoostDelay = 7 * time.Second
View Source
const LevelTitleDelay = 4 * time.Second
View Source
const MaxPlayers = 2

Variables

View Source
var (
	CanvasBounds = pixel.R(-1920/2, -1080/2, 1920/2, 1080/2)
)
View Source
var Players []ControlScheme

Functions

func Draw

func Draw(win *pixelgl.Window, canvas *pixelgl.Canvas)

func Render

func Render(win *pixelgl.Window)

func TransitionTo

func TransitionTo(o Scene)

Types

type Bullet

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

type ControlScheme

type ControlScheme struct {
	Thrust, Left, Right, Shoot, Boost InputMethod
}

func (ControlScheme) Controls

func (cs ControlScheme) Controls(win *pixelgl.Window) Controls

type ControllerInput

type ControllerInput interface {
	Controls(win *pixelgl.Window) Controls
}

type Controls

type Controls struct {
	Left, Right, Thrust, Boost, Shoot bool
}

type DestroyableScene

type DestroyableScene interface {
	Scene
	Destroy()
}

type InputMethod

type InputMethod interface {
	GetInput(win *pixelgl.Window) bool
	String() string
}

type JoystickAxisInputMethod

type JoystickAxisInputMethod struct {
	Joystick pixelgl.Joystick
	Axis     int
	// Inverse makes GetInput return true when |axis|>threshold && axis < 0.
	Inverse   bool
	Threshold float64
	Alias     string
}

func (JoystickAxisInputMethod) GetInput

func (im JoystickAxisInputMethod) GetInput(win *pixelgl.Window) bool

func (JoystickAxisInputMethod) String

func (im JoystickAxisInputMethod) String() string

type JoystickButtonInputMethod

type JoystickButtonInputMethod struct {
	Joystick pixelgl.Joystick
	Button   int
	Alias    string
}

func (JoystickButtonInputMethod) GetInput

func (im JoystickButtonInputMethod) GetInput(win *pixelgl.Window) bool

func (JoystickButtonInputMethod) String

func (im JoystickButtonInputMethod) String() string

type KeyboardInputMethod

type KeyboardInputMethod struct {
	Button pixelgl.Button
}

func (KeyboardInputMethod) GetInput

func (im KeyboardInputMethod) GetInput(win *pixelgl.Window) bool

func (KeyboardInputMethod) String

func (im KeyboardInputMethod) String() string

type LevelScene

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

func PlayLevel

func PlayLevel(index int) *LevelScene

func (*LevelScene) Render

func (s *LevelScene) Render(win *pixelgl.Window)

type LevelTitleScene

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

func (*LevelTitleScene) Render

func (s *LevelTitleScene) Render(win *pixelgl.Window)

type MainscreenScene

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

func (*MainscreenScene) Destroy

func (s *MainscreenScene) Destroy()

func (*MainscreenScene) Render

func (s *MainscreenScene) Render(win *pixelgl.Window)

type Player

type Player struct {
	Ship           *Ship
	TargetPosition cp.Vector
	LastBoost      time.Time
	Color          color.Color
	ControlScheme
}

type Scene

type Scene interface {
	// Render is called repeatedly as long as this Scene is the currently active scene (the value of current).
	Render(win *pixelgl.Window)
}

Scene represents a logical division of the game (like a slide in PowerPoint).

func Death

func Death(index int) Scene

func Play

func Play() Scene

func Start

func Start() Scene

func TitleScene

func TitleScene(index int) Scene

func Win

func Win() Scene

type Ship

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

type WinScene

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

func (*WinScene) Destroy

func (s *WinScene) Destroy()

func (*WinScene) Render

func (s *WinScene) Render(win *pixelgl.Window)

Jump to

Keyboard shortcuts

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