Moveable rock
This commit is contained in:
parent
b44ca800d3
commit
7d8c34401c
|
@ -8,7 +8,7 @@ atlas = ExtResource("1_6r1ml")
|
||||||
region = Rect2(16.535, 15.865, 15.895, 17.055)
|
region = Rect2(16.535, 15.865, 15.895, 17.055)
|
||||||
|
|
||||||
[sub_resource type="CircleShape2D" id="CircleShape2D_55vvm"]
|
[sub_resource type="CircleShape2D" id="CircleShape2D_55vvm"]
|
||||||
radius = 6.32456
|
radius = 18.0
|
||||||
|
|
||||||
[node name="Node2D" type="Node2D"]
|
[node name="Node2D" type="Node2D"]
|
||||||
script = ExtResource("1_55vvm")
|
script = ExtResource("1_55vvm")
|
||||||
|
|
3
rock.gd
3
rock.gd
|
@ -2,4 +2,5 @@ extends Node2D
|
||||||
|
|
||||||
func _on_area_2d_input_event(viewport: Node, event: InputEvent, shape_idx: int) -> void:
|
func _on_area_2d_input_event(viewport: Node, event: InputEvent, shape_idx: int) -> void:
|
||||||
if Input.is_mouse_button_pressed(MOUSE_BUTTON_LEFT):
|
if Input.is_mouse_button_pressed(MOUSE_BUTTON_LEFT):
|
||||||
print("check")
|
var destination = get_global_mouse_position()
|
||||||
|
position = position.move_toward(destination, 100)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user