Move all engine stuff to GoRetro. Still many interactions between game and engine code that there should not be.

This commit is contained in:
stevenhowes
2022-01-03 22:13:34 +00:00
commit 4d1ab58ca4
19 changed files with 976 additions and 0 deletions
+40
View File
@@ -0,0 +1,40 @@
package GoRetro
/*
* --------------------
* moverLinear
* --------------------
* A simple mover that moves the container a fixed
* distance each tick in the direction of its rotation
*/
import (
"math"
)
type moverLinear struct {
container *Element
speed float64
}
func NewMoverLinear(container *Element, speed float64) *moverLinear {
return &moverLinear{container: container, speed: speed}
}
func (mover *moverLinear) onDraw() error {
return nil
}
func (mover *moverLinear) onUpdate() error {
c := mover.container
// Move, taking into account rotation in degrees
c.Position.X += mover.speed * math.Sin(c.Rotation*(math.Pi/180)) * Delta
c.Position.Y += mover.speed * math.Cos(c.Rotation*(math.Pi/180)) * Delta
return nil
}
func (mover *moverLinear) onCollision(other *Element) error {
return nil
}