--- a/src/proto2/Physics.cc Mon Dec 01 22:35:54 2008 +0000
+++ b/src/proto2/Physics.cc Mon Dec 01 22:36:32 2008 +0000
@@ -43,23 +43,23 @@
}
Vector PhysicsObject::walk (bool right) {
- Vector cursor = this->position + shape[2] + (right ? Vector(1,0) : Vector(-1,0));
+ Vector cursor = this->position + (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.collides(cursor)) {
+ if(world.collides(cursor+shape[2])) {
for(int height = 0, max = 2; height < max+42; height++) {
if(height >= max)
return reached;
cursor.y--;
- if(!world.collides(cursor)) {
+ if(!world.collides(cursor+shape[2])) {
// Check that the other parts of the worm don't collide with anything
if(possibleLocation(cursor)) {
- reached = cursor - shape[2];
+ reached = cursor;
continue;
} else {
// Can't get any further
@@ -69,7 +69,7 @@
}
} else {
if(possibleLocation(cursor)) {
- reached = cursor - shape[2];
+ reached = cursor;
}
// Start checking if the lower squares are empty
@@ -79,7 +79,7 @@
// We can start a free fall now
//
// TODO it should be set inAir if it falls from a cliff
- this->inAir = true;
+// this->inAir = true;
// Put some speed there to make loke smoother
//this->velocity.y = -5;
@@ -87,10 +87,10 @@
}
cursor.y++;
- if(!world.collides(cursor)) {
+ if(!world.collides(cursor+shape[2])) {
// Check that the other parts of the worm don't collide with anything
if(possibleLocation(cursor)) {
- reached = cursor - shape[2];
+ reached = cursor;
continue;
} else {
// Can't get any further