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.

25 lines
479 B

8 months ago
package component
import (
"code.rocketnine.space/tslocum/gohan"
7 months ago
"code.rocketnine.space/tslocum/monovania/engine"
8 months ago
)
type PositionComponent struct {
X, Y float64
}
7 months ago
var PositionComponentID = engine.Engine.NewComponentID()
8 months ago
func (p *PositionComponent) ComponentID() gohan.ComponentID {
return PositionComponentID
}
7 months ago
func Position(ctx *gohan.Context) *PositionComponent {
c, ok := ctx.Component(PositionComponentID).(*PositionComponent)
8 months ago
if !ok {
return nil
}
return c
}