playerpkg

package
Version: v0.0.0-...-f1dee3b Latest Latest
Warning

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

Go to latest
Published: May 9, 2019 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Player

type Player interface {
	Move(dx float32, dy float32)
	Shoot(x float32, y float32, dx float32, dy float32)

	GetPlayerProto() *Message_proto.Player

	GetPosition() common.Point
	SetPosition(common.Point)
	GetName() string
	GetID() int32
	GetClientID() int32
	GetNextReload() time.Time
	SetHealth(health float32)
	GetHealth() float32
	AddScore()

	IsEnable() bool
	SetEnable(enable bool)

	// Box interface
	GetTop() float32
	GetBottom() float32
	GetLeft() float32
	GetRight() float32

	// Client related Data
	SetCurrentInputNumber(int32)

	// Body interface
	GetCircle() shape.Circle
}

func NewPlayer

func NewPlayer(playerID int32, clientID int32, name string) Player

NewPlayer returns new player

type PlayerImpl

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

func (*PlayerImpl) AddScore

func (p *PlayerImpl) AddScore()

AddScore add score of player by 1. It is called when user killed an enemy

func (*PlayerImpl) GetBottom

func (p *PlayerImpl) GetBottom() float32

func (*PlayerImpl) GetCircle

func (p *PlayerImpl) GetCircle() shape.Circle

func (*PlayerImpl) GetClientID

func (p *PlayerImpl) GetClientID() int32

GetClientID ...

func (*PlayerImpl) GetHealth

func (p *PlayerImpl) GetHealth() float32

GetHealth ...

func (*PlayerImpl) GetID

func (p *PlayerImpl) GetID() int32

GetID ...

func (*PlayerImpl) GetLeft

func (p *PlayerImpl) GetLeft() float32

Box interface

func (*PlayerImpl) GetName

func (p *PlayerImpl) GetName() string

GetName ...

func (*PlayerImpl) GetNextReload

func (p *PlayerImpl) GetNextReload() time.Time

GetNextReload gets the next allowed shoot time.

func (*PlayerImpl) GetPlayerProto

func (p *PlayerImpl) GetPlayerProto() *Message_proto.Player

GetPlayerProto returns player proto

func (*PlayerImpl) GetPosition

func (p *PlayerImpl) GetPosition() common.Point

GetPlayerProto ...

func (*PlayerImpl) GetRect

func (p *PlayerImpl) GetRect() shape.Rect

GetRect returns a boundary rectangle of player

func (*PlayerImpl) GetRight

func (p *PlayerImpl) GetRight() float32

func (*PlayerImpl) GetSize

func (p *PlayerImpl) GetSize() float32

func (*PlayerImpl) GetTop

func (p *PlayerImpl) GetTop() float32

func (*PlayerImpl) IsEnable

func (p *PlayerImpl) IsEnable() bool

func (*PlayerImpl) Move

func (p *PlayerImpl) Move(dx float32, dy float32)

Move in dx and dy, dx and dy have to be calculated according to timeElapsed beforehand

func (*PlayerImpl) SetCurrentInputNumber

func (p *PlayerImpl) SetCurrentInputNumber(curNumber int32)

func (*PlayerImpl) SetEnable

func (p *PlayerImpl) SetEnable(enable bool)

func (*PlayerImpl) SetHealth

func (p *PlayerImpl) SetHealth(health float32)

func (*PlayerImpl) SetPosition

func (p *PlayerImpl) SetPosition(point common.Point)

SetPosition ...

func (*PlayerImpl) Shoot

func (p *PlayerImpl) Shoot(x float32, y float32, dx float32, dy float32)

Shoot fires a bullet at x, y with direction dx, dy

type Position

type Position struct {
	X float32
	Y float32
}

Source Files

Jump to

Keyboard shortcuts

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