player

package
v0.0.0-...-d471c43 Latest Latest
Warning

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

Go to latest
Published: Jun 26, 2019 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Package player stores the playable character that can be used in all game scenes.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Player

type Player struct {
	// general.Basic contains the essential
	// parts of a Xaro game object such as
	// the scale, spritesheet, and aseprite.
	*general.Basic
	// ShootSpeed controls the speed at which
	// the player can use their weapon.
	ShootSpeed float32
	// MoveSpeed is the variable that affects
	// the movement speed the player can move at.
	MoveSpeed float32
	// IsShooting is a current state booleon
	// to check if the player is actioning.
	IsShooting bool
	// Velocity stores the X, and Y variables
	// At which the player is moving towards.
	Velocity engo.Point
	// ecs.BasicEntity is used for indentifying
	// this specific entity in the game. This
	// is used for deletion as well.
	ecs.BasicEntity
	// common.RenderComponent is the component
	// that allows this struct to render into the game.
	common.RenderComponent
	// common.SpaceComponent contains essential spacial
	// variables such as position, size, and rotation.
	common.SpaceComponent
	// common.MouseComponent allows this game object
	// to read from the mouse input using engo's systems.
	common.MouseComponent
	// common.CollisionComponent is the collision box for the player.
	common.CollisionComponent
}

Player is the main game object that represents a Xaro client. This is a playable struct...

func NewPlayer

func NewPlayer() (*Player, error)

NewPlayer creates a new blank player to be passed around the game.

func (*Player) Prepare

func (p *Player) Prepare(pos *engo.Point)

func (*Player) Remove

func (p *Player) Remove(ecs.BasicEntity)

Remove deletes the player and player systems

func (*Player) SetPosition

func (p *Player) SetPosition(pos *engo.Point)

SetPosition takes a reference to a point and sets the position to it.

func (*Player) Update

func (p *Player) Update(dt float32)

Update gets called every frame

Jump to

Keyboard shortcuts

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