cleans up some code

This commit is contained in:
Nathan Singer 2025-04-27 13:14:56 -04:00
parent 9217834726
commit 5937b4db69

36
card.gd
View File

@ -52,26 +52,28 @@ func _physics_process(delta: float) -> void:
func _gui_input(event: InputEvent) -> void: func _gui_input(event: InputEvent) -> void:
if event is InputEventMouseButton: if event is not InputEventMouseButton:
match event.button_index: return
MOUSE_BUTTON_LEFT: match event.button_index:
if event.pressed: MOUSE_BUTTON_LEFT:
is_dragging = true if event.pressed:
mouse_offset = get_global_mouse_position() - global_position is_dragging = true
else: mouse_offset = get_global_mouse_position() - global_position
is_dragging = false else:
MOUSE_BUTTON_RIGHT: is_dragging = false
pass MOUSE_BUTTON_RIGHT:
pass
func _unhandled_key_input(event: InputEvent) -> void: func _unhandled_key_input(event: InputEvent) -> void:
if event.is_action_pressed("default_action"): if not event.is_action_pressed("default_action"):
if current_pivot == pivot.ROTATE_0: return
current_pivot = pivot.ROTATE_90 if current_pivot == pivot.ROTATE_0:
is_pivot = true current_pivot = pivot.ROTATE_90
else: is_pivot = true
current_pivot = pivot.ROTATE_0 else:
is_pivot = true current_pivot = pivot.ROTATE_0
is_pivot = true
func _card_error(error_type: String) -> String: func _card_error(error_type: String) -> String:
return "ERROR::CARD::%s::%s::%s::\n" % [card_id, card_name, error_type] return "ERROR::CARD::%s::%s::%s::\n" % [card_id, card_name, error_type]