Metroidvania game
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.

27 lines
536 B

package component
import (
"code.rocketnine.space/tslocum/gohan"
"github.com/hajimehoshi/ebiten/v2"
)
type SpriteComponent struct {
Image *ebiten.Image
HorizontalFlip bool
VerticalFlip bool
DiagonalFlip bool // TODO unimplemented
}
var SpriteComponentID = gohan.NewComponentID()
func (p *SpriteComponent) ComponentID() gohan.ComponentID {
return SpriteComponentID
}
func Sprite(e gohan.Entity) *SpriteComponent {
c, ok := e.Component(SpriteComponentID).(*SpriteComponent)
if !ok {
return nil
}
return c
}