You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
39 lines
426 B
Go
39 lines
426 B
Go
package main
|
|
|
|
import (
|
|
"sync"
|
|
|
|
"github.com/hajimehoshi/ebiten/v2"
|
|
)
|
|
|
|
const (
|
|
itemTypeGarlic = iota
|
|
itemTypeHolyWater
|
|
)
|
|
|
|
type gameItem struct {
|
|
x, y float64
|
|
|
|
sprite *ebiten.Image
|
|
|
|
itemType int
|
|
|
|
level *Level
|
|
player *gamePlayer
|
|
|
|
health int
|
|
|
|
sync.Mutex
|
|
}
|
|
|
|
func (item *gameItem) useScore() int {
|
|
switch item.itemType {
|
|
case itemTypeGarlic:
|
|
return 275
|
|
case itemTypeHolyWater:
|
|
return 150
|
|
default:
|
|
return 0
|
|
}
|
|
}
|