pkg

package
v0.0.0-...-0f051d9 Latest Latest
Warning

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

Go to latest
Published: Dec 7, 2022 License: MIT Imports: 1 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Player

type Player struct {
	CurrentVector Vector
	TargetVector  Vector
	Speed         float32
}

func NewPlayer

func NewPlayer(Speed float32) Player

初始化玩家,设置速度

func (Player) IsArrived

func (p Player) IsArrived() bool

是否到达目标位置

func (*Player) MoveTo

func (p *Player) MoveTo(v Vector)

设置目标位置

func (Player) Position

func (p Player) Position() Vector

获取当前位置

func (*Player) Update

func (p *Player) Update()

更新玩家位置

type Vector

type Vector struct {
	X float32
	Y float32
}

Jump to

Keyboard shortcuts

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