src/Rope.cc
changeset 427 01e77fe8c040
parent 417 c503e0c6a740
child 428 712b943195a6
equal deleted inserted replaced
426:510c83aab425 427:01e77fe8c040
    21     shape[3] = Vector(1, -1);
    21     shape[3] = Vector(1, -1);
    22     setShape(shape);
    22     setShape(shape);
    23 }
    23 }
    24 
    24 
    25 void Rope::throwRope (void) {
    25 void Rope::throwRope (void) {
       
    26     if (state == ROPE_FIXED) {
       
    27         // unset pivot if we re-throw rope
       
    28         player.setPivot(NULL);
       
    29     }
       
    30 
       
    31     // update state
    26     state = ROPE_FLYING;
    32     state = ROPE_FLYING;
    27 
    33 
    28     // XXX: this should probably be more dynamic?
    34     // XXX: this should probably be more dynamic?
    29     length = ROPE_LENGTH;
    35     length = ROPE_LENGTH;
    30     
    36     
    31     // copy position + velocity from player
    37     // copy position + velocity from player
    32     setPosition (player.getPosition());
    38     setPosition(player.getPosition());
    33     velocity = player.getVelocity() + player.getDirection() * ROPE_VELOCITY;
    39     setVelocity(player.getVelocity() + player.getDirection() * ROPE_VELOCITY);
    34     
    40     
    35     // we are FLYING
    41     // we are FLYING
    36     inAir = true;
    42     inAir = true;
    37     
    43     
    38     // enable the physics object
    44     // enable the physics object