Kimpoominen oikein.
--- a/src/proto2/Physics.cc Tue Nov 18 21:20:07 2008 +0000
+++ b/src/proto2/Physics.cc Tue Nov 18 21:20:35 2008 +0000
@@ -41,11 +41,14 @@
Engine::log(DEBUG, "physics.update_position") << "position=" << newPosition << ", velocity=" << velocity;
- if (newPosition.x < 0 || (newPosition.x > world.dimensions.x) || (newPosition.y < 0) || (newPosition.y >= world.dimensions.y)) {
+ if (newPosition.x < 0 || (newPosition.x > world.dimensions.x)) {
// CRASH!
- this->velocity *= -1;
-
- } else {
+ this->velocity.x *= -1;
+ }
+ else if(newPosition.y < 0 || (newPosition.y >= world.dimensions.y)) {
+ this->velocity.y *= -1;
+ }
+ else {
this->position = newPosition;
}
}