Mercurial > projects > openmelee
diff ships/ship.d @ 24:441eb7672404
impleneted steer to avoid
author | zzzzrrr <mason.green@gmail.com> |
---|---|
date | Fri, 27 Mar 2009 16:05:24 -0400 |
parents | 4fce5596d1f6 |
children | 88cca12cc8b9 |
line wrap: on
line diff
--- a/ships/ship.d Thu Mar 26 20:35:58 2009 -0400 +++ b/ships/ship.d Fri Mar 27 16:05:24 2009 -0400 @@ -41,7 +41,7 @@ alias LinkedList!(bzShape) ShapeList; -class State +struct State { bzVec2 position; bzVec2 velocity; @@ -52,11 +52,12 @@ float speed = 0; float maxForce = 0; bool turn; - float radius = 0.0f; float enemyAngle = 0.0f; bzVec2 avoid; + Ship enemy; + bzVec2 predictFuturePosition(float dt) { return (position + velocity * dt); } @@ -82,7 +83,6 @@ this(bzWorld world) { this.world = world; shapes = new ShapeList; - state = new State; } void thrust() { @@ -127,12 +127,10 @@ } void calcRadius() { - rBody.userData = state; for (bzShape s = rBody.shapeList; s; s = s.next) { if(s.sweepRadius > state.radius) { state.radius = s.sweepRadius; } } } - }