Attention | Topic was automatically imported from the old Question2Answer platform. | |
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 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