Added rock that detects mouse
This commit is contained in:
parent
b92ab1aae8
commit
b44ca800d3
24
Rock.tscn
Normal file
24
Rock.tscn
Normal file
|
@ -0,0 +1,24 @@
|
|||
[gd_scene load_steps=5 format=3 uid="uid://chpqjpcexhd3t"]
|
||||
|
||||
[ext_resource type="Texture2D" uid="uid://8uv7dd4m5ne" path="res://rocks.png" id="1_6r1ml"]
|
||||
[ext_resource type="Script" uid="uid://caa0o3l446c85" path="res://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 = 6.32456
|
||||
|
||||
[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"]
|
|
@ -37,3 +37,8 @@ moveDown={
|
|||
"events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":83,"key_label":0,"unicode":115,"location":0,"echo":false,"script":null)
|
||||
]
|
||||
}
|
||||
Grab={
|
||||
"deadzone": 0.2,
|
||||
"events": [Object(InputEventMouseButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"button_mask":0,"position":Vector2(0, 0),"global_position":Vector2(0, 0),"factor":1.0,"button_index":1,"canceled":false,"pressed":false,"double_click":false,"script":null)
|
||||
]
|
||||
}
|
||||
|
|
5
rock.gd
Normal file
5
rock.gd
Normal file
|
@ -0,0 +1,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")
|
1
rock.gd.uid
Normal file
1
rock.gd.uid
Normal file
|
@ -0,0 +1 @@
|
|||
uid://caa0o3l446c85
|
34
rocks.png.import
Normal file
34
rocks.png.import
Normal file
|
@ -0,0 +1,34 @@
|
|||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://8uv7dd4m5ne"
|
||||
path="res://.godot/imported/rocks.png-f11897abd7424866675c3df5d51b470d.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://rocks.png"
|
||||
dest_files=["res://.godot/imported/rocks.png-f11897abd7424866675c3df5d51b470d.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
|
|
@ -1,10 +1,11 @@
|
|||
[gd_scene load_steps=4 format=4 uid="uid://ccjb75bercbw8"]
|
||||
[gd_scene load_steps=5 format=4 uid="uid://ccjb75bercbw8"]
|
||||
|
||||
[ext_resource type="TileSet" uid="uid://xnedi1edel2b" path="res://tileMaps/baseTileset.tres" id="1_a7uaa"]
|
||||
[ext_resource type="PackedScene" uid="uid://c1xy5bf2p6vmh" path="res://player.tscn" id="2_lsvd3"]
|
||||
[ext_resource type="PackedScene" uid="uid://darxbklsgh23m" path="res://collectableCrystal.tscn" id="3_x45i2"]
|
||||
[ext_resource type="PackedScene" uid="uid://chpqjpcexhd3t" path="res://Rock.tscn" id="4_0dbve"]
|
||||
|
||||
[node name="Node2D" type="Node2D"]
|
||||
[node name="Rock" type="Node2D"]
|
||||
|
||||
[node name="wallLayer" type="TileMapLayer" parent="."]
|
||||
z_index = 10
|
||||
|
@ -22,3 +23,6 @@ position = Vector2(373, 125)
|
|||
|
||||
[node name="Area2D" parent="." instance=ExtResource("3_x45i2")]
|
||||
position = Vector2(401, 240)
|
||||
|
||||
[node name="Node2D" parent="." instance=ExtResource("4_0dbve")]
|
||||
position = Vector2(498, 169)
|
||||
|
|
Loading…
Reference in New Issue
Block a user