18 lines
433 B
GDScript3
18 lines
433 B
GDScript3
|
extends Node2D
|
||
|
|
||
|
|
||
|
# Called when the node enters the scene tree for the first time.
|
||
|
func _ready():
|
||
|
pass # Replace with function body.
|
||
|
|
||
|
|
||
|
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||
|
func _process(delta):
|
||
|
var dir = (get_global_mouse_position() - global_position).normalized()
|
||
|
global_rotation = dir.angle() + PI / 2.0
|
||
|
if global_rotation < 0:
|
||
|
$Sprite2D.flip_v = true
|
||
|
else:
|
||
|
$Sprite2D.flip_v = false
|
||
|
|