mirror of
https://github.com/stevenhowes/GoRetro.git
synced 2026-05-26 15:53:31 +01:00
Move all engine stuff to GoRetro. Still many interactions between game and engine code that there should not be.
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
package GoRetro
|
||||
|
||||
import "math"
|
||||
|
||||
type Vector struct {
|
||||
X float64
|
||||
Y float64
|
||||
}
|
||||
|
||||
func vectorAdd(v1, v2 Vector) Vector {
|
||||
return Vector{
|
||||
X: v1.X + v2.X,
|
||||
Y: v1.Y + v2.Y,
|
||||
}
|
||||
}
|
||||
|
||||
func vectorDistance(v1, v2 Vector) float64 {
|
||||
return math.Sqrt(math.Pow(v2.X-v1.X, 2) +
|
||||
math.Pow(v2.Y-v1.Y, 2))
|
||||
}
|
||||
Reference in New Issue
Block a user