clowder/tscn/gun.gd
2024-03-06 22:05:35 +01:00

18 lines
433 B
GDScript

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