0 votes

Hi guys, how are you?

Im working on a Flappy Bird clone and I have a problem. When the bird flap I want it to rotate instantly to a 30 degree angle. It does but it last only a fraction of a second and then comes back to its previous angle. How can I archive that? Here is my code

extends RigidBody2D

func _physics_process(delta):
  if Input.is_action_just_pressed("ui_jump"):

  if (linear_velocity.y > 0):

func _flap():
  set_linear_velocity(Vector2(linear_velocity.x, -200))

func _rotate():
in Engine by (14 points)

See, the physics engine gets fussy if you directly mess with the RigidBody2D in the wrong way.

Look into the _integrate_forces(state) method that RigidBody2D has.

Please log in or register to answer this question.

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.