moved move out of vector lib
This commit is contained in:
parent
e33f2c0c4f
commit
b142845b5c
2
game.go
2
game.go
@ -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
12
geom.go
Normal 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)
|
||||
}
|
Loading…
Reference in New Issue
Block a user