Mercurial > projects > openmelee
comparison main.d @ 14:af1e8620f027
fixed steering
author | zzzzrrr <mason.green@gmail.com> |
---|---|
date | Mon, 23 Mar 2009 14:06:47 -0400 |
parents | e1004697cae1 |
children | 8e6a9e390cba |
comparison
equal
deleted
inserted
replaced
13:e1004697cae1 | 14:af1e8620f027 |
---|---|
75 gui.immediate.end; | 75 gui.immediate.end; |
76 | 76 |
77 StopWatch timer; | 77 StopWatch timer; |
78 | 78 |
79 jobHub.addRepeatableJob( { | 79 jobHub.addRepeatableJob( { |
80 // Update AI | |
81 ai.move(whut.ship1); | |
82 // Update physics | 80 // Update physics |
83 whut.world.step(timeStep, settings.velocityIterations, | 81 whut.world.step(timeStep, settings.velocityIterations, |
84 settings.positionIterations); | 82 settings.positionIterations); |
83 // Update AI | |
84 ai.move(whut.ship1); | |
85 }, ITERS_PER_SECOND); | 85 }, ITERS_PER_SECOND); |
86 | 86 |
87 bool running = true; | 87 bool running = true; |
88 | 88 |
89 jobHub.addPreFrameJob( { | 89 jobHub.addPreFrameJob( { |
90 whut.ship1.limitVelocity(); | |
91 whut.ship2.limitVelocity(); | |
90 whut.ship1.updateState(); | 92 whut.ship1.updateState(); |
91 whut.ship2.updateState(); | 93 whut.ship2.updateState(); |
92 whut.ship1.limitVelocity(); | |
93 whut.ship2.limitVelocity(); | |
94 }); | 94 }); |
95 | 95 |
96 jobHub.addPostFrameJob( { | 96 jobHub.addPostFrameJob( { |
97 gui.begin(cfg); | 97 gui.begin(cfg); |
98 gui.push(`main`); | 98 gui.push(`main`); |
113 { | 113 { |
114 vec2 p1 = vec2.from(whut.ship1.rBody.position); | 114 vec2 p1 = vec2.from(whut.ship1.rBody.position); |
115 vec2 p2 = vec2.from(whut.ship2.rBody.position); | 115 vec2 p2 = vec2.from(whut.ship2.rBody.position); |
116 vec2 distance = p1 - p2; | 116 vec2 distance = p1 - p2; |
117 float d = distance.length; | 117 float d = distance.length; |
118 whut.zoom = bzClamp(1/d*1000, 5, 50); | 118 whut.zoom = bzClamp(1/d*1000, 2, 50); |
119 whut.viewCenter = p1 - (distance * 0.5f); | 119 whut.viewCenter = p1 - (distance * 0.5f); |
120 } | 120 } |
121 | 121 |
122 }); | 122 }); |
123 | 123 |