So I’m new to unity and I followed a flappy bird tutorial. I’m trying to make my bird move around the screen using the left and right keys, but when i press space the left and right motion stop working.
// share your code here, please
So I’m new to unity and I followed a flappy bird tutorial. I’m trying to make my bird move around the screen using the left and right keys, but when i press space the left and right motion stop working.
// share your code here, please
When You press Space Button, You set the velocity of myRigidBody
to Vector2.up * flapStrength;
It means the current velocity of Bird is new Vector2(0,flapStrength);
In other words You Update the velocity of X-axis to 0
You must have to give velocity of x-axis to Rigidbody, Like:
myRigidBody.velocity = new Vector2(myRigidbody.velocity.x,flapStrength);