2024-12-10 18:55:23 -05:00
|
|
|
package gamedata
|
|
|
|
|
|
2024-12-14 06:36:45 -05:00
|
|
|
import "math"
|
|
|
|
|
|
2024-12-14 11:32:41 -05:00
|
|
|
type DinoType int
|
|
|
|
|
|
|
|
|
|
const (
|
|
|
|
|
DinoTypeGreen DinoType = iota
|
|
|
|
|
DinoTypeBlue
|
|
|
|
|
DinoTypeRed
|
|
|
|
|
DinoTypeYellow
|
|
|
|
|
DinoTypeMax
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
type DinoAction int
|
|
|
|
|
|
|
|
|
|
const (
|
|
|
|
|
DinoActionIdle DinoAction = iota
|
|
|
|
|
DinoActionWalk
|
|
|
|
|
DinoActionSlap
|
|
|
|
|
DinoActionMax
|
|
|
|
|
)
|
|
|
|
|
|
2024-12-10 18:55:23 -05:00
|
|
|
type Coordinates struct {
|
|
|
|
|
X float64 `json:"X"`
|
|
|
|
|
Y float64 `json:"Y"`
|
|
|
|
|
}
|
2024-12-14 06:36:45 -05:00
|
|
|
|
|
|
|
|
func (c Coordinates) Distance(p Coordinates) float64 {
|
|
|
|
|
dx := p.X - c.X
|
|
|
|
|
dy := p.Y - c.Y
|
|
|
|
|
return math.Sqrt(dx*dx + dy*dy)
|
|
|
|
|
}
|