2021-10-05 03:47:29 +00:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
|
|
|
"time"
|
|
|
|
)
|
|
|
|
|
2021-10-28 03:52:02 +00:00
|
|
|
var weaponUzi = &playerWeapon{
|
|
|
|
sprite: imageAtlas[ImageUzi],
|
|
|
|
cooldown: 100 * time.Millisecond,
|
|
|
|
}
|
|
|
|
|
2021-10-05 03:47:29 +00:00
|
|
|
type gamePlayer struct {
|
|
|
|
x, y float64
|
|
|
|
|
|
|
|
angle float64
|
|
|
|
|
|
|
|
weapon *playerWeapon
|
2021-10-06 04:05:02 +00:00
|
|
|
|
2021-10-28 03:52:02 +00:00
|
|
|
hasTorch bool
|
|
|
|
|
2021-10-07 00:29:28 +00:00
|
|
|
score int
|
|
|
|
|
2021-10-22 08:31:30 +00:00
|
|
|
soulsRescued int
|
|
|
|
|
2021-10-06 04:05:02 +00:00
|
|
|
health int
|
2021-10-12 03:22:13 +00:00
|
|
|
|
2021-10-20 01:46:11 +00:00
|
|
|
garlicUntil time.Time
|
|
|
|
holyWaterUntil time.Time
|
2021-10-05 03:47:29 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
func NewPlayer() (*gamePlayer, error) {
|
|
|
|
p := &gamePlayer{
|
2021-10-28 03:52:02 +00:00
|
|
|
weapon: weaponUzi,
|
|
|
|
hasTorch: true,
|
|
|
|
health: 3,
|
2021-10-05 03:47:29 +00:00
|
|
|
}
|
|
|
|
return p, nil
|
|
|
|
}
|