Want to rotate the arrow with input

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By rafah

Hi all I have a ball that is launched sort of like a angry birds situation, so basically I manage to make it all the way where you can launch the ball 3 times, and I managed to make the Arrow appear, but I have no idea how to make it rotate, any pointers would be greatly appreciated :slight_smile: I marked the line with <<------ this is the line that does nothing.

extends RigidBody2D

var dragging
var drag_start = Vector2()
var drag_end = Vector2()
var launched = false
var try= 3
const Arrow = preload('res://scenes/Player/Arrow.tscn')
var arrow = null
var dir

func _ready():
	arrow = Arrow.instance()
	add_child(arrow)
	arrow.hide()

func _input(event):
	if (try != 0):
		if event.is_action_pressed("click") and not dragging and not launched:
			dragging = true
			arrow.show()
			arrow.get_rotation() <<-----------------NO ROTATION HERE, NADA
			drag_start = get_global_mouse_position()
		if event.is_action_released("click") and dragging:
			dragging = false
			launched = true
			try -= 1
			drag_end = get_global_mouse_position()
			dir = drag_start - drag_end
			apply_impulse(Vector2(), dir * 5)
			arrow.hide()
			yield(get_tree().create_timer(5.0), "timeout")
            launched = false
:bust_in_silhouette: Reply From: markopolo

arrow.get_rotation() does not cause rotation to happen, it exists to give you access to the current rotation state. You need to use arrow.set_rotation(radians) or arrow.rotation = radians if you want to change the node’s rotation.