move

package
v2.4.0 Latest Latest
Warning

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

Go to latest
Published: Aug 15, 2020 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Arrows

func Arrows(mvr Mover)

Arrows moves the given mover based on its speed as the arrow keys are pressed

func CenterScreenOn

func CenterScreenOn(mvr Mover)

CenterScreenOn will cause the screen to center on the given mover, obeying viewport limits if they have been set previously

func Limit

func Limit(mvr Mover, rect floatgeom.Rect2)

Limit restricts the movement of the mover to stay within a given rectangle

func ShiftX

func ShiftX(mvr Mover, x float64)

ShiftX will ShiftX on the vector of the mover and set the renderable and space positions to that of the updated vector.

func ShiftY

func ShiftY(mvr Mover, y float64)

ShiftY will ShiftY on the vector of the mover and set the renderable and space positions to that of the updated vector.

func TopDown

func TopDown(mvr Mover, up, down, left, right string)

TopDown moves the given mover based on its speed as the given keys are pressed

func WASD

func WASD(mvr Mover)

WASD moves the given mover based on its speed as W,A,S, and D are pressed

Types

type Mover

type Mover interface {
	Vec() physics.Vector
	GetRenderable() render.Renderable
	GetDelta() physics.Vector
	GetSpace() *collision.Space
	GetSpeed() physics.Vector
}

A Mover can move its position, renderable, and space. Unless otherwise documented, functions effecting a mover move all of its logical position, renderable, and space simultaneously.

Jump to

Keyboard shortcuts

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