This site is currently in read-only mode during migration to a new platform.
You cannot post questions, answers or comments, as they would be lost during the migration otherwise.
0 votes

I am successfully rotating a node to mouse position by tweening.
After the rotation tween finishes, I want to use a second tween to move the node to mouse position. The ontweencompleted function gets called, "rotation_degrees" gets printed, but not "Rotation ended". Why? What am I missing?

func rotate_tween(target_position: Vector2):
  var angle_to_target: float = rad2deg(parent.get_angle_to(target_position))

        parent.rotation_degrees + angle_to_target, 

func _on_tween_completed(object, key):
  print(object, key)
  if key == "rotation_degrees":
    print("Rotation ended")
Godot version 3.3.2.stable
related to an answer for: On_tween_complete parameters
in Engine by (46 points)

1 Answer

+1 vote
Best answer

The correct code is:

if key == ":rotation_degrees":

I missed ":"

by (46 points)
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 Frequently asked questions and 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 [email protected] with your username.