diff --git a/card.gd b/card.gd index 2c09d6a..1384778 100644 --- a/card.gd +++ b/card.gd @@ -28,7 +28,7 @@ var mouse_offset: Vector2 func _pivot() -> int: - var deg: int + var deg: int match current_pivot: pivot.ROTATE_0: deg = 0 @@ -52,26 +52,28 @@ func _physics_process(delta: float) -> void: func _gui_input(event: InputEvent) -> void: - if event is InputEventMouseButton: - match event.button_index: - MOUSE_BUTTON_LEFT: - if event.pressed: - is_dragging = true - mouse_offset = get_global_mouse_position() - global_position - else: - is_dragging = false - MOUSE_BUTTON_RIGHT: - pass + if event is not InputEventMouseButton: + return + match event.button_index: + MOUSE_BUTTON_LEFT: + if event.pressed: + is_dragging = true + mouse_offset = get_global_mouse_position() - global_position + else: + is_dragging = false + MOUSE_BUTTON_RIGHT: + pass func _unhandled_key_input(event: InputEvent) -> void: - if event.is_action_pressed("default_action"): - if current_pivot == pivot.ROTATE_0: - current_pivot = pivot.ROTATE_90 - is_pivot = true - else: - current_pivot = pivot.ROTATE_0 - is_pivot = true + if not event.is_action_pressed("default_action"): + return + if current_pivot == pivot.ROTATE_0: + current_pivot = pivot.ROTATE_90 + is_pivot = true + else: + current_pivot = pivot.ROTATE_0 + is_pivot = true func _card_error(error_type: String) -> String: return "ERROR::CARD::%s::%s::%s::\n" % [card_id, card_name, error_type]