added primary and secondary player mode
This commit is contained in:
@@ -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
16
components/player.go
Normal 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]
|
||||
}
|
||||
Reference in New Issue
Block a user