34 lines
460 B
Go
34 lines
460 B
Go
package gamedata
|
|
|
|
import "math"
|
|
|
|
type DinoType int
|
|
|
|
const (
|
|
DinoTypeGreen DinoType = iota
|
|
DinoTypeBlue
|
|
DinoTypeRed
|
|
DinoTypeYellow
|
|
DinoTypeMax
|
|
)
|
|
|
|
type DinoAction int
|
|
|
|
const (
|
|
DinoActionIdle DinoAction = iota
|
|
DinoActionWalk
|
|
DinoActionSlap
|
|
DinoActionMax
|
|
)
|
|
|
|
type Coordinates struct {
|
|
X float64 `json:"X"`
|
|
Y float64 `json:"Y"`
|
|
}
|
|
|
|
func (c Coordinates) Distance(p Coordinates) float64 {
|
|
dx := p.X - c.X
|
|
dy := p.Y - c.Y
|
|
return math.Sqrt(dx*dx + dy*dy)
|
|
}
|