--- a/src/proto2/Physics.cc Mon Dec 01 21:54:22 2008 +0000
+++ b/src/proto2/Physics.cc Mon Dec 01 22:24:17 2008 +0000
@@ -43,15 +43,14 @@
}
Vector PhysicsObject::walk (bool right) {
- Vector cursor = right ? this->position + Vector(1,0) :
- this->position + Vector(-1,0);
+ Vector cursor = this->position + shape[2] + (right ? Vector(1,0) : Vector(-1,0));
Vector reached = this->position;
//for(int steps = 0; steps < 3; steps++) {
// Go up but not if the wall is over two pixels
if(world.getType(cursor) != EMPTY) {
- for(int height = 0, max = 3; height < max+42; height++) {
+ for(int height = 0, max = 2; height < max+42; height++) {
if(height >= max)
return reached;
@@ -60,7 +59,7 @@
if(world.getType(cursor) == EMPTY) {
// Check that the other parts of the worm don't collide with anything
if(possibleLocation(cursor)) {
- reached = cursor;
+ reached = cursor - shape[2];
continue;
} else {
// Can't get any further
@@ -70,7 +69,7 @@
}
} else {
if(possibleLocation(cursor)) {
- reached = cursor;
+ reached = cursor - shape[2];
}
// Start checking if the lower squares are empty
@@ -91,7 +90,7 @@
if(world.getType(cursor) == EMPTY) {
// Check that the other parts of the worm don't collide with anything
if(possibleLocation(cursor)) {
- reached = cursor;
+ reached = cursor - shape[2];
continue;
} else {
// Can't get any further