BeatTheStreet/src/player.cpp
//Void function for player movement in the y-axis when on a boat, extraspeed is passed through for when presents are collected.
Void function for player movement in the y-axis when on a boat, extraspeed is passed through for when presents are collected.
Void function for player movement in the y - axis when on a boat extraspeed is passed through for when presents are collected .
void Player::moveOnBoat(float fExtraSpeed)
{
	float fMoveOnLogSpeed;
	if (sPlayer.getPosition().y >  80 && sPlayer.getPosition().y < 130) { fMoveOnLogSpeed = 5; }
	else if (sPlayer.getPosition().y > 130 && sPlayer.getPosition().y < 180) { fMoveOnLogSpeed = -4; }
	else if (sPlayer.getPosition().y > 180 && sPlayer.getPosition().y < 230) { fMoveOnLogSpeed = 3; }
	else if (sPlayer.getPosition().y > 230 && sPlayer.getPosition().y < 280) { fMoveOnLogSpeed = -2; }
	else if (sPlayer.getPosition().y > 280 && sPlayer.getPosition().y < 330) { fMoveOnLogSpeed = 1; }
	if (fMoveOnLogSpeed < 0)fMoveOnLogSpeed = fMoveOnLogSpeed  - fExtraSpeed;
	else if (fMoveOnLogSpeed > 0) fMoveOnLogSpeed = fMoveOnLogSpeed + fExtraSpeed;
	sPlayer.move(fMoveOnLogSpeed, 0);
}
void Player :: moveOnBoat ( float fExtraSpeed ) { float fMoveOnLogSpeed ; if ( sPlayer . getPosition ( ) . y > 80 && sPlayer . getPosition ( ) . y < 130 ) { fMoveOnLogSpeed = 5 ; } else if ( sPlayer . getPosition ( ) . y > 130 && sPlayer . getPosition ( ) . y < 180 ) { fMoveOnLogSpeed = -4 ; } else if ( sPlayer . getPosition ( ) . y > 180 && sPlayer . getPosition ( ) . y < 230 ) { fMoveOnLogSpeed = 3 ; } else if ( sPlayer . getPosition ( ) . y > 230 && sPlayer . getPosition ( ) . y < 280 ) { fMoveOnLogSpeed = -2 ; } else if ( sPlayer . getPosition ( ) . y > 280 && sPlayer . getPosition ( ) . y < 330 ) { fMoveOnLogSpeed = 1 ; } if ( fMoveOnLogSpeed < 0 ) fMoveOnLogSpeed = fMoveOnLogSpeed - fExtraSpeed ; else if ( fMoveOnLogSpeed > 0 ) fMoveOnLogSpeed = fMoveOnLogSpeed + fExtraSpeed ; sPlayer . move ( fMoveOnLogSpeed , 0 ) ; }
Void function for player movement in the y-axis when on a boat, extraspeed is passed through for when presents are collected.
Void function for player movement in the y - axis when on a boat extraspeed is passed through for when presents are collected .
//The movement speed is dependent in which water lane the player is in. //Extra speed is added which changes as more presents are collected. //Move the player