gohan-bunnymark/system/velocity.go

23 lines
468 B
Go

package system
import (
"code.rocketnine.space/tslocum/gohan"
"code.rocketnine.space/tslocum/gohan-bunnymark/component"
"github.com/hajimehoshi/ebiten/v2"
)
type Velocity struct {
Position *component.Position
Velocity *component.Velocity
}
func (v *Velocity) Update(_ gohan.Entity) error {
v.Position.X += v.Velocity.X
v.Position.Y += v.Velocity.Y
return nil
}
func (v *Velocity) Draw(_ gohan.Entity, _ *ebiten.Image) error {
return gohan.ErrUnregister
}