Somewhat working prototype
This commit is contained in:
31
src/empty_space_thing.gd
Normal file
31
src/empty_space_thing.gd
Normal file
@@ -0,0 +1,31 @@
|
||||
extends Control
|
||||
class_name SpaceNode
|
||||
|
||||
var initial_pos: Vector2
|
||||
var offset: Vector2
|
||||
var draggable: bool = false
|
||||
|
||||
func _ready() -> void:
|
||||
draggable = true
|
||||
return
|
||||
|
||||
func _process(delta: float) -> void:
|
||||
if draggable:
|
||||
|
||||
if Input.is_action_pressed("click", true):
|
||||
self.global_position = Vector2(get_global_mouse_position().x, self.global_position.y)
|
||||
|
||||
elif Input.is_action_just_released("click"):
|
||||
|
||||
is_dragging.is_dragging = false
|
||||
var tween = get_tree().create_tween()
|
||||
|
||||
tween.tween_property(self, "global_position", Vector2(get_global_mouse_position().x, self.global_position.y), 0.5).set_ease(Tween.EASE_IN_OUT)
|
||||
|
||||
else:
|
||||
return
|
||||
|
||||
func reset_draggable():
|
||||
if not is_dragging.is_dragging:
|
||||
is_dragging.is_dragging = false
|
||||
draggable = false
|
||||
Reference in New Issue
Block a user