diff --git a/src/empty_space_thing.gd b/src/empty_space_thing.gd index e4d96ed..6b6fab2 100644 --- a/src/empty_space_thing.gd +++ b/src/empty_space_thing.gd @@ -1,15 +1,18 @@ extends Control class_name SpaceNode +# adapted from pc_tile code (project-elysium-main) var initial_pos: Vector2 var offset: Vector2 var draggable: bool = false var velocity: float = 0 +# variables for velocity calculation var mouse_first_location: Vector2 var mouse_release_location: Vector2 var time_since_first_location: float = -1 +# Export variables, for ease of setting without going into the code @export var velocity_coeffecient: int = 500 @export var max_x: int = 1000 @export var min_x: int = 0 @@ -47,6 +50,7 @@ func _process(delta: float) -> void: draggable = false elif not draggable: + # when the drag is complete, create a tween to ease out towards zero var tween = get_tree().create_tween() tween.tween_property(self, "velocity", 0, ease_out_time).set_ease(Tween.EASE_OUT) mouse_first_location = Vector2(0,0)