character

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Jul 24, 2020 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewPlayers

func NewPlayers() error

NewPlayers load all player characters.

Types

type Lanes

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

Lanes manages the player's lane to run.

func (*Lanes) Ascend

func (l *Lanes) Ascend() bool

Ascend sets the target lane to ascend.

func (*Lanes) Descend

func (l *Lanes) Descend() bool

Descend sets the target lane to descend. When this function is triggered successfully, true is returned.

func (*Lanes) IsBottom

func (l *Lanes) IsBottom() bool

IsBottom returns which the player's lane is bottom one.

func (*Lanes) IsReachedTarget

func (l *Lanes) IsReachedTarget(height float64) bool

IsReachedTarget returns wchich the player reached the target.

func (*Lanes) IsTop

func (l *Lanes) IsTop() bool

IsTop returns which the player's lane is top one.

func (*Lanes) SetHeights

func (l *Lanes) SetHeights(heights []float64) error

SetHeights sets the heights of the lanes.

type Player

type Player struct {
	// Specified at creation and not changed
	StandingImage *ebiten.Image
	Description   string
	// contains filtered or unexported fields
}

Player is a player character.

var (
	Kurona     *Player
	Koma       *Player
	Shishimaru *Player

	// Selected is the selected player.
	Selected *Player
)

player characters

func (*Player) BeBlocked added in v0.0.4

func (p *Player) BeBlocked(blocked bool)

BeBlocked puts the player in a position where the path is blocked by an obstacle.

func (*Player) Close

func (p *Player) Close() error

Close closes the inner resources.

func (*Player) Draw

func (p *Player) Draw(screen *ebiten.Image) error

Draw draws the character image.

func (*Player) Eat added in v0.0.4

func (p *Player) Eat(stamina int)

Eat eats foods and restore stamina value by argument value.

func (*Player) GetOffset added in v0.0.4

func (p *Player) GetOffset() image.Point

GetOffset returns the offset to draw other filed parts.

func (*Player) GetPosition added in v0.0.4

func (p *Player) GetPosition() view.Vector

GetPosition return the current position of this player.

func (*Player) GetRectangle added in v0.0.4

func (p *Player) GetRectangle() image.Rectangle

GetRectangle returns the edge rentangle of this player.

func (*Player) GetStamina added in v0.0.4

func (p *Player) GetStamina() int

GetStamina returns the stamina value fo this character.

func (*Player) GetVelocity added in v0.0.4

func (p *Player) GetVelocity() view.Vector

GetVelocity returns the velocity of this playable character.

func (*Player) InitilizeWithLanesInfo added in v0.0.4

func (p *Player) InitilizeWithLanesInfo(heights []float64) error

InitilizeWithLanesInfo sets the lanes information. The player can run on the lane or move between lanes based on the lane drawing height information received in the argument.

func (*Player) Pause

func (p *Player) Pause()

Pause pauses this character.

func (*Player) ReStart

func (p *Player) ReStart()

ReStart starts again this character.

func (*Player) Start

func (p *Player) Start()

Start starts playing.

func (*Player) Update

func (p *Player) Update() error

Update updates the character regarding the user input.

type Stamina added in v0.0.4

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

Stamina manages the consumption and recovery of stamina.

func NewStamina added in v0.0.4

func NewStamina(max, endurance int) *Stamina

NewStamina returns a new stamina engine.

func (*Stamina) Consumes added in v0.0.4

func (s *Stamina) Consumes(val int)

Consumes encourages a decrease in stamina by the value specified in the argument. The actual stamina is reduced when the consumption is greater than the "endurance". The stamina value does not go below zero.

func (*Stamina) GetStamina added in v0.0.4

func (s *Stamina) GetStamina() int

GetStamina returns the current stamina value.

func (*Stamina) Initialize added in v0.0.4

func (s *Stamina) Initialize()

Initialize initializes stamina engine.

func (*Stamina) Restore added in v0.0.4

func (s *Stamina) Restore(val int)

Restore restores the stamina to the value specified in the argument. However, it will not restore more than the maximum value.

type State

type State int

State describes the state of a character.

const (
	Pause State = iota
	Walk
	Dash
	Ascending
	Descending
)

States

type StepAnimation

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

StepAnimation is an animation. This animates according to the number of steps.

func NewStepAnimation

func NewStepAnimation(frames []*ebiten.Image, duration int) *StepAnimation

NewStepAnimation returns a new StepAnimation generated with args.

func (*StepAnimation) AddStep

func (s *StepAnimation) AddStep(steps int)

AddStep adds steps information. If your character moved, please call this function with steps information.

func (*StepAnimation) GetCurrentFrame

func (s *StepAnimation) GetCurrentFrame() *ebiten.Image

GetCurrentFrame returns a current frame image. This function determines the current frame based on the information on how far a character moved. If the sum of steps is grater than the DurationSteps, this function will return the next frame.

type TimeAnimation

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

TimeAnimation is an animation. This animates according to elapsed time.

func NewTimeAnimation

func NewTimeAnimation(frames []*ebiten.Image, duration float64) *TimeAnimation

NewTimeAnimation returns a new TimeAnimation generated with args.

func (*TimeAnimation) GetCurrentFrame

func (t *TimeAnimation) GetCurrentFrame() *ebiten.Image

GetCurrentFrame returns a current frame image. This function determines the current frame according to elapsed time. If the elapsed time is grater than the DurationSecond, this function will return the next frame.

Jump to

Keyboard shortcuts

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