src/Rope.cc
changeset 428 712b943195a6
parent 427 01e77fe8c040
equal deleted inserted replaced
427:01e77fe8c040 428:712b943195a6
    76         player.setPivot(this);
    76         player.setPivot(this);
    77     }
    77     }
    78 
    78 
    79     // attached to something!
    79     // attached to something!
    80     state = ROPE_FIXED;
    80     state = ROPE_FIXED;
    81     velocity = Vector(0,0);
    81 
       
    82     // XXX: reset, except we override tick() in ugly ways
       
    83     setVelocity(Vector(0,0));
    82         
    84         
    83     // Ropes location will be used as the pivot point, so move the location to the collisionPoint.
    85     // Ropes location will be used as the pivot point, so move the location to the collisionPoint.
    84     // Currently the position is something like one pixel away from the collisionPoint where there isn't ground.
    86     // Currently the position is something like one pixel away from the collisionPoint where there isn't ground.
    85     setPosition(collisionPoint);
    87     setPosition(collisionPoint);
    86     
    88     
   202         // if player's pivot is some other player, then don't re-check the terrain
   204         // if player's pivot is some other player, then don't re-check the terrain
   203         if (player.getPivot() != this)
   205         if (player.getPivot() != this)
   204             return;
   206             return;
   205 
   207 
   206         // If there's no ground on the pivot point anymore, release the rope
   208         // If there's no ground on the pivot point anymore, release the rope
   207         if (!world.terrain.collides(position)) { 
   209         if (!world.terrain.collides(getPosition())) { 
   208             // XXX: move to some new method
   210             // XXX: move to some new method
   209             state = ROPE_FLYING;
   211             state = ROPE_FLYING;
   210             length = ROPE_LENGTH;
   212             length = ROPE_LENGTH;
   211             inAir = true;
   213             inAir = true;
   212             player.setPivot(NULL);
   214             player.setPivot(NULL);