fixes tapped cards having a weird drag offset
This commit is contained in:
parent
c463bf0adc
commit
9217834726
6
card.gd
6
card.gd
@ -22,7 +22,7 @@ var oracle_text: String
|
||||
var is_dragging = false
|
||||
var is_pivot = false
|
||||
|
||||
var delay = 5.0 # TODO find the best value for this
|
||||
var delay = 5.0
|
||||
var mouse_offset: Vector2
|
||||
|
||||
|
||||
@ -38,17 +38,17 @@ func _pivot() -> int:
|
||||
deg = 180
|
||||
pivot.ROTATE_270:
|
||||
deg = 270
|
||||
is_pivot = false
|
||||
return deg
|
||||
|
||||
|
||||
func _physics_process(delta: float) -> void:
|
||||
if is_dragging == true:
|
||||
var tween = get_tree().create_tween()
|
||||
tween.tween_property(self, "position", get_global_mouse_position() - mouse_offset, delay * delta)
|
||||
tween.tween_property(self, "position", get_global_mouse_position() - mouse_offset.rotated(deg_to_rad(-1.0 * _pivot())), delay * delta)
|
||||
if is_pivot == true:
|
||||
var tween = get_tree().create_tween()
|
||||
tween.tween_property(self, "rotation_degrees", _pivot(), delta * delay)
|
||||
is_pivot = false
|
||||
|
||||
|
||||
func _gui_input(event: InputEvent) -> void:
|
||||
|
Loading…
x
Reference in New Issue
Block a user