41 lines
646 B
Go
41 lines
646 B
Go
package entities
|
|
|
|
type Team int
|
|
|
|
const (
|
|
TeamRed Team = iota
|
|
TeamBlue
|
|
)
|
|
|
|
type Role int
|
|
|
|
const (
|
|
RoleStriker Role = iota
|
|
RoleDefender
|
|
RoleGoalie
|
|
)
|
|
|
|
type Player struct {
|
|
Position Vector2
|
|
Velocity Vector2
|
|
Radius float64
|
|
Team Team
|
|
Role Role
|
|
HomePosition Vector2
|
|
MaxSpeed float64
|
|
Acceleration float64
|
|
}
|
|
|
|
func NewPlayer(x, y float64, team Team, role Role) *Player {
|
|
return &Player{
|
|
Position: Vector2{X: x, Y: y},
|
|
HomePosition: Vector2{X: x, Y: y},
|
|
Velocity: Vector2{X: 0, Y: 0},
|
|
Radius: 15,
|
|
Team: team,
|
|
Role: role,
|
|
MaxSpeed: 3.0,
|
|
Acceleration: 0.1,
|
|
}
|
|
}
|