Removed rock & adapted its script to the crystals

This commit is contained in:
theskywinds 2025-05-19 19:10:43 +02:00
parent ec2839792b
commit cff461189c
7 changed files with 18 additions and 68 deletions

View File

@ -11,4 +11,8 @@ func _on_body_entered(body: Node2D) -> void:
queue_free() queue_free()
else: else:
print("Whoops, something went wrong") print("Whoops, something went wrong")
func _on_mouse_collision_input_event(viewport: Node, event: InputEvent, shape_idx: int) -> void:
if Input.is_mouse_button_pressed(MOUSE_BUTTON_LEFT):
var destination = get_global_mouse_position()
global_position = global_position.move_toward(destination, 1.0)

View File

@ -1,4 +1,4 @@
[gd_scene load_steps=8 format=3 uid="uid://darxbklsgh23m"] [gd_scene load_steps=9 format=3 uid="uid://darxbklsgh23m"]
[ext_resource type="Script" uid="uid://dmyoo12ntx27" path="res://collectables/crystal/collect_crystal.gd" id="1_ttvq1"] [ext_resource type="Script" uid="uid://dmyoo12ntx27" path="res://collectables/crystal/collect_crystal.gd" id="1_ttvq1"]
[ext_resource type="Texture2D" uid="uid://igfk66vn3kwf" path="res://collectables/crystal/Sprites/Crystal_0001.png" id="2_s8vun"] [ext_resource type="Texture2D" uid="uid://igfk66vn3kwf" path="res://collectables/crystal/Sprites/Crystal_0001.png" id="2_s8vun"]
@ -29,8 +29,12 @@ animations = [{
[sub_resource type="CircleShape2D" id="CircleShape2D_lmbvg"] [sub_resource type="CircleShape2D" id="CircleShape2D_lmbvg"]
radius = 17.0 radius = 17.0
[sub_resource type="CircleShape2D" id="CircleShape2D_m1y8f"]
radius = 114.07
[node name="crystal" type="Area2D"] [node name="crystal" type="Area2D"]
collision_layer = 0 collision_layer = 3
collision_mask = 3
script = ExtResource("1_ttvq1") script = ExtResource("1_ttvq1")
[node name="AnimatedSprite2D" type="AnimatedSprite2D" parent="."] [node name="AnimatedSprite2D" type="AnimatedSprite2D" parent="."]
@ -43,4 +47,11 @@ autoplay = "default"
position = Vector2(0, -1) position = Vector2(0, -1)
shape = SubResource("CircleShape2D_lmbvg") shape = SubResource("CircleShape2D_lmbvg")
[node name="mouseCollision" type="Area2D" parent="."]
[node name="CollisionShape2D" type="CollisionShape2D" parent="mouseCollision"]
shape = SubResource("CircleShape2D_m1y8f")
debug_color = Color(0.99368, 0, 0.23394, 0.42)
[connection signal="body_entered" from="." to="." method="_on_body_entered"] [connection signal="body_entered" from="." to="." method="_on_body_entered"]
[connection signal="input_event" from="mouseCollision" to="." method="_on_mouse_collision_input_event"]

View File

@ -1,24 +0,0 @@
[gd_scene load_steps=5 format=3 uid="uid://chpqjpcexhd3t"]
[ext_resource type="Texture2D" uid="uid://8uv7dd4m5ne" path="res://rock/rocks.png" id="1_6r1ml"]
[ext_resource type="Script" uid="uid://caa0o3l446c85" path="res://rock/rock.gd" id="1_55vvm"]
[sub_resource type="AtlasTexture" id="AtlasTexture_55vvm"]
atlas = ExtResource("1_6r1ml")
region = Rect2(16.535, 15.865, 15.895, 17.055)
[sub_resource type="CircleShape2D" id="CircleShape2D_55vvm"]
radius = 31.0
[node name="Node2D" type="Node2D"]
script = ExtResource("1_55vvm")
[node name="Sprite2D" type="Sprite2D" parent="."]
texture = SubResource("AtlasTexture_55vvm")
[node name="Area2D" type="Area2D" parent="."]
[node name="CollisionShape2D" type="CollisionShape2D" parent="Area2D"]
shape = SubResource("CircleShape2D_55vvm")
[connection signal="input_event" from="Area2D" to="." method="_on_area_2d_input_event"]

View File

@ -1,6 +0,0 @@
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):
var destination = get_global_mouse_position()
position = position.move_toward(destination, 100)

View File

@ -1 +0,0 @@
uid://caa0o3l446c85

Binary file not shown.

Before

Width:  |  Height:  |  Size: 716 B

View File

@ -1,34 +0,0 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://8uv7dd4m5ne"
path="res://.godot/imported/rocks.png-31e9fdd0c761c959532605b940b863f9.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://rock/rocks.png"
dest_files=["res://.godot/imported/rocks.png-31e9fdd0c761c959532605b940b863f9.ctex"]
[params]
compress/mode=0
compress/high_quality=false
compress/lossy_quality=0.7
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=false
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=1