Hello, i need a solution for a 2d shot game. The player still shot to the right direction, i have no idea how i change the bullet direction when he walk to the left side?
//Touch Shot Button
if(btn.btnRect3.contains(worldPos)){
isFiring = true;
}
//bullet shot details
if(isFiring == true){
bullet newBullet (Vector2f( 20, 20));
newBullet.bulletSetPos(Vector2f(player.playerSprite.getPosition().x + 60, player.playerSprite.getPosition().y + 100));
bulletVec.push_back(newBullet);
isFiring = false;
}
Any Ideas
I search something that turn the following values into negative values when the player turns left
The player.playerSprite.getPosition().y + 100)) < -- the 100 have urn into - 100
newBullet.bulletSetPos(Vector2f(player.playerSprite.getPosition().x + 60, player.playerSprite.getPosition().y + 100));
An the move value 3 have to turn into -3
bulletRec.move(0, 3);
For the players face direction i used setScale(3, -3 ) and setScale (3, 3)