BeatTheStreet/src/player.cpp
//Void function used to reset the sprite after it has died.
Void function used to reset the sprite after it has died.
Void function used to reset the sprite after it has died .
void Player::resetPlayer(bool bPLayerMovingDown)
{
	float  iRespawnY;
	if (playerYPosition() == 105 || playerYPosition() == 155 || playerYPosition() == 205 || playerYPosition() == 255 || playerYPosition() == 305)
	{
		if (bPLayerMovingDown == true) iRespawnY = 55;
		else iRespawnY = 355;
	}
	else if (playerYPosition() == 405 || playerYPosition() == 455) 
	{
		if (bPLayerMovingDown == true) iRespawnY = 355;
		else iRespawnY = 505;
	}
	else if (playerYPosition() == 555 ||  playerYPosition() == 605 || playerYPosition() == 655 || playerYPosition() == 705 || playerYPosition() == 755)
	{
		if (bPLayerMovingDown == true) iRespawnY = 505;
		else iRespawnY = 805;
	}
	else iRespawnY = 805; 
	sPlayer.setPosition(375, iRespawnY);
	if (!bPLayerMovingDown)sPlayer.setTexture(pTextureBack);
	else sPlayer.setTexture(pTextureFront);
	playerfadeinclock.restart();
}
void Player :: resetPlayer ( bool bPLayerMovingDown ) { float iRespawnY ; if ( playerYPosition ( ) == 105 || playerYPosition ( ) == 155 || playerYPosition ( ) == 205 || playerYPosition ( ) == 255 || playerYPosition ( ) == 305 ) { if ( bPLayerMovingDown == true ) iRespawnY = 55 ; else iRespawnY = 355 ; } else if ( playerYPosition ( ) == 405 || playerYPosition ( ) == 455 ) { if ( bPLayerMovingDown == true ) iRespawnY = 355 ; else iRespawnY = 505 ; } else if ( playerYPosition ( ) == 555 || playerYPosition ( ) == 605 || playerYPosition ( ) == 655 || playerYPosition ( ) == 705 || playerYPosition ( ) == 755 ) { if ( bPLayerMovingDown == true ) iRespawnY = 505 ; else iRespawnY = 805 ; } else iRespawnY = 805 ; sPlayer . setPosition ( 375 , iRespawnY ) ; if ( ! bPLayerMovingDown ) sPlayer . setTexture ( pTextureBack ) ; else sPlayer . setTexture ( pTextureFront ) ; playerfadeinclock . restart ( ) ; }
Void function used to reset the sprite after it has died.
Void function used to reset the sprite after it has died .
//Thh player will respawn at the begining of the area where they died. //Initalise variabvle for y respawn location. //Depending on where the player dies, and which direction they where traveling the player will respawn in a diffrent location. //Drowned //Hit by train //Hit by Car //Deafult //Set the position back to the start //Reset the texture dependin on which direction the player will be travelling. //Reset the fade in clock so that the player fades back in.