added primary and secondary player mode

This commit is contained in:
2024-02-22 19:40:49 +01:00
parent 308f335cd1
commit c93070883a
12 changed files with 174 additions and 10 deletions

View File

@@ -24,7 +24,6 @@ type Speed struct {
type Tilish struct{}
type Solid struct{}
type Floor struct{}
type Player struct{}
type Collectible struct{}
type Obstacle struct {

16
components/player.go Normal file
View File

@@ -0,0 +1,16 @@
package components
import "github.com/hajimehoshi/ebiten/v2"
type Player struct {
IsPrimary bool
Sprites []*ebiten.Image
}
func (player *Player) SwitchSprite() *ebiten.Image {
if player.IsPrimary {
return player.Sprites[0]
}
return player.Sprites[1]
}