diff options
| author | Magnus Auvinen <magnus.auvinen@gmail.com> | 2007-12-10 21:51:49 +0000 |
|---|---|---|
| committer | Magnus Auvinen <magnus.auvinen@gmail.com> | 2007-12-10 21:51:49 +0000 |
| commit | f5066fe62bd62f8a5bfb488fe6da8d5648e431bc (patch) | |
| tree | a46f580c57dc08e7503410df0f0aff1057bf7aa7 /src | |
| parent | 110834e85983f586f50b2b13498ff2924f8073aa (diff) | |
| download | zcatch-f5066fe62bd62f8a5bfb488fe6da8d5648e431bc.tar.gz zcatch-f5066fe62bd62f8a5bfb488fe6da8d5648e431bc.zip | |
fixed the corner bug. I hope
Diffstat (limited to 'src')
| -rw-r--r-- | src/game/game.cpp | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/game/game.cpp b/src/game/game.cpp index 79ef8e1a..2632b64b 100644 --- a/src/game/game.cpp +++ b/src/game/game.cpp @@ -75,15 +75,17 @@ void move_box(vec2 *inout_pos, vec2 *inout_vel, vec2 size, float elasticity) vec2 new_pos = pos + vel*fraction; // TODO: this row is not nice - if(test_box(new_pos, size)) + // make sure that we quantize. this is to make sure that when we set + // the final position that we don't move it into the ground. + if(test_box(vec2((int)new_pos.x,(int) new_pos.y), size)) { - if(test_box(vec2(pos.x, new_pos.y), size)) + if(test_box(vec2((int)pos.x, (int)new_pos.y), size)) { new_pos.y = pos.y; vel.y *= -elasticity; } - if(test_box(vec2(new_pos.x, pos.y), size)) + if(test_box(vec2((int)new_pos.x, (int)pos.y), size)) { new_pos.x = pos.x; vel.x *= -elasticity; |