Twin-stick shooter
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

45 lines
597 B

3 months ago
package main
import (
"image"
"time"
"github.com/hajimehoshi/ebiten/v2"
)
type gamePlayer struct {
x, y float64
angle float64
weapon *playerWeapon
score int
health int
3 months ago
repelUntil time.Time
3 months ago
}
func NewPlayer() (*gamePlayer, error) {
f, err := assetsFS.Open("assets/weapons/uzi.png")
if err != nil {
return nil, err
}
img, _, err := image.Decode(f)
if err != nil {
return nil, err
}
uziSprite := ebiten.NewImageFromImage(img)
p := &gamePlayer{
weapon: &playerWeapon{
sprite: uziSprite,
cooldown: 100 * time.Millisecond,
},
health: 3,
3 months ago
}
return p, nil
}