From 7d8c34401c35258610f206e08fa22b960fde9310 Mon Sep 17 00:00:00 2001 From: Nicholas Date: Sun, 18 May 2025 12:20:23 +0100 Subject: [PATCH] Moveable rock --- Rock.tscn | 2 +- rock.gd | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/Rock.tscn b/Rock.tscn index 40e290f..bb7df5b 100644 --- a/Rock.tscn +++ b/Rock.tscn @@ -8,7 +8,7 @@ atlas = ExtResource("1_6r1ml") region = Rect2(16.535, 15.865, 15.895, 17.055) [sub_resource type="CircleShape2D" id="CircleShape2D_55vvm"] -radius = 6.32456 +radius = 18.0 [node name="Node2D" type="Node2D"] script = ExtResource("1_55vvm") diff --git a/rock.gd b/rock.gd index 5fd3670..7b25663 100644 --- a/rock.gd +++ b/rock.gd @@ -2,4 +2,5 @@ extends Node2D func _on_area_2d_input_event(viewport: Node, event: InputEvent, shape_idx: int) -> void: if Input.is_mouse_button_pressed(MOUSE_BUTTON_LEFT): - print("check") + var destination = get_global_mouse_position() + position = position.move_toward(destination, 100)