moved move out of vector lib

This commit is contained in:
Stephen McQuay 2013-09-28 09:44:47 -07:00
parent e33f2c0c4f
commit b142845b5c
3 changed files with 14 additions and 3 deletions

View File

@ -187,7 +187,7 @@ func (g *game) run() {
func (g *game) nudgeProjectiles() (rprojectiles []Projectile) {
rprojectiles = make([]Projectile, 0)
for p := range g.projectiles {
newPos := v.Move(p.Position, p.MoveTo, float64(p.Speed), delta)
newPos := move(p.Position, p.MoveTo, float64(p.Speed), delta)
hit_player := false
for player := range g.players {

12
geom.go Normal file
View File

@ -0,0 +1,12 @@
package main
import (
"bitbucket.org/hackerbots/vector"
)
func move(d1, d2 govector.Point2d, velocity float64, timeDelta float64) govector.Point2d {
v := d2.Sub(d1)
v_norm := v.Normalize()
v_scaled := v_norm.Scale(velocity * timeDelta)
return d1.Add(v_scaled)
}

View File

@ -1,7 +1,6 @@
package main
import (
v "bitbucket.org/hackerbots/vector"
)