add pressure plate

This commit is contained in:
Fabio 2024-08-19 01:29:43 +02:00
parent 3a66839841
commit 9432084b53
9 changed files with 275 additions and 26 deletions

View file

@ -3,6 +3,21 @@
[ext_resource type="Script" path="res://scripts/goal.gd" id="1_xjaxa"]
[ext_resource type="Texture2D" uid="uid://bje753fyfin0" path="res://textures/01-Portal-Sheet.png" id="2_hsts4"]
[sub_resource type="Animation" id="Animation_v2oub"]
length = 0.001
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath("Sprite2D:frame_coords")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 1,
"values": [Vector2i(0, 0)]
}
[sub_resource type="Animation" id="Animation_a6qt0"]
resource_name = "portal"
length = 0.55
@ -20,21 +35,6 @@ tracks/0/keys = {
"values": [Vector2i(0, 0), Vector2i(1, 0), Vector2i(2, 0), Vector2i(3, 0), Vector2i(4, 0), Vector2i(5, 0), Vector2i(6, 0), Vector2i(7, 0)]
}
[sub_resource type="Animation" id="Animation_v2oub"]
length = 0.001
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath("Sprite2D:frame_coords")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 1,
"values": [Vector2i(0, 0)]
}
[sub_resource type="AnimationLibrary" id="AnimationLibrary_4pqp1"]
_data = {
"RESET": SubResource("Animation_v2oub"),

View file

@ -0,0 +1,34 @@
[gd_scene load_steps=5 format=3 uid="uid://c168bkledwyya"]
[ext_resource type="Texture2D" uid="uid://c3m4os8kteaix" path="res://textures/level01-spritesheet.png" id="1_6whpg"]
[sub_resource type="AtlasTexture" id="AtlasTexture_dplbn"]
atlas = ExtResource("1_6whpg")
region = Rect2(192.002, 64.0069, 32.0036, 31.9977)
[sub_resource type="AtlasTexture" id="AtlasTexture_7sk3t"]
atlas = ExtResource("1_6whpg")
region = Rect2(128.019, 31.9952, 31.9608, 31.9949)
[sub_resource type="RectangleShape2D" id="RectangleShape2D_jee2l"]
size = Vector2(6, 28.5)
[node name="StaticBody2D" type="StaticBody2D"]
collision_mask = 5
[node name="Sprite2D2" type="Sprite2D" parent="."]
position = Vector2(1, 0)
texture = SubResource("AtlasTexture_dplbn")
[node name="CollisionPolygon2D" type="CollisionPolygon2D" parent="."]
polygon = PackedVector2Array(-15, -15, -12, -11, 14, -11, 17, -15)
[node name="StaticBody2D" type="StaticBody2D" parent="."]
[node name="Sprite2D" type="Sprite2D" parent="StaticBody2D"]
texture = SubResource("AtlasTexture_7sk3t")
region_rect = Rect2(0, 0, 288, 96)
[node name="CollisionShape2D" type="CollisionShape2D" parent="StaticBody2D"]
position = Vector2(1, 2)
shape = SubResource("RectangleShape2D_jee2l")

View file

@ -13,7 +13,7 @@ radius = 12.0
[node name="Player" type="CharacterBody2D"]
collision_layer = 4
collision_mask = 19
collision_mask = 51
script = ExtResource("1_a6lhy")
jump_strength = 600

View file

@ -0,0 +1,89 @@
[gd_scene load_steps=9 format=3 uid="uid://c6g2f7tm7iasr"]
[ext_resource type="Script" path="res://scripts/PressurePlate.gd" id="1_7ar3x"]
[ext_resource type="Texture2D" uid="uid://cwf57p0osmc0w" path="res://textures/PressurePlate.png" id="1_st48m"]
[sub_resource type="RectangleShape2D" id="RectangleShape2D_82l2r"]
size = Vector2(32, 3.5)
[sub_resource type="RectangleShape2D" id="RectangleShape2D_c6ukx"]
size = Vector2(24, 4)
[sub_resource type="Animation" id="Animation_fulu2"]
resource_name = "Disable"
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath("Sprite2D:frame")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 1,
"values": [1]
}
[sub_resource type="Animation" id="Animation_7ggr5"]
length = 0.001
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath("Sprite2D:frame")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 1,
"values": [1]
}
[sub_resource type="Animation" id="Animation_xxdm0"]
resource_name = "Enable"
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath("Sprite2D:frame")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 1,
"values": [0]
}
[sub_resource type="AnimationLibrary" id="AnimationLibrary_usrhb"]
_data = {
"Disable": SubResource("Animation_fulu2"),
"Enable": SubResource("Animation_xxdm0"),
"RESET": SubResource("Animation_7ggr5")
}
[node name="StaticBody2D" type="StaticBody2D"]
script = ExtResource("1_7ar3x")
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
position = Vector2(0, 13.75)
shape = SubResource("RectangleShape2D_82l2r")
[node name="Area2D" type="Area2D" parent="."]
[node name="CollisionShape2D" type="CollisionShape2D" parent="Area2D"]
position = Vector2(0, 10)
shape = SubResource("RectangleShape2D_c6ukx")
[node name="Sprite2D" type="Sprite2D" parent="."]
texture = ExtResource("1_st48m")
hframes = 2
frame = 1
[node name="AnimationPlayer" type="AnimationPlayer" parent="."]
libraries = {
"": SubResource("AnimationLibrary_usrhb")
}
autoplay = "Disable"
[connection signal="body_entered" from="Area2D" to="." method="_on_area_2d_body_entered"]
[connection signal="body_exited" from="Area2D" to="." method="_on_area_2d_body_exited"]

View file

@ -0,0 +1,86 @@
[gd_scene load_steps=8 format=3 uid="uid://c6g2f7tm7iasr"]
[ext_resource type="Script" path="res://scripts/PressurePlate.gd" id="1_7ar3x"]
[ext_resource type="Texture2D" uid="uid://cwf57p0osmc0w" path="res://textures/PressurePlate.png" id="1_st48m"]
[sub_resource type="RectangleShape2D" id="RectangleShape2D_c6ukx"]
size = Vector2(24, 5)
[sub_resource type="Animation" id="Animation_fulu2"]
resource_name = "Disable"
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath("Sprite2D:frame")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 1,
"values": [1]
}
[sub_resource type="Animation" id="Animation_7ggr5"]
length = 0.001
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath("Sprite2D:frame")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 1,
"values": [1]
}
[sub_resource type="Animation" id="Animation_xxdm0"]
resource_name = "Enable"
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath("Sprite2D:frame")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 1,
"values": [0]
}
[sub_resource type="AnimationLibrary" id="AnimationLibrary_usrhb"]
_data = {
"Disable": SubResource("Animation_fulu2"),
"Enable": SubResource("Animation_xxdm0"),
"RESET": SubResource("Animation_7ggr5")
}
[node name="PressurePlate" type="StaticBody2D"]
collision_mask = 5
script = ExtResource("1_7ar3x")
[node name="Area2D" type="Area2D" parent="."]
[node name="CollisionShape2D" type="CollisionShape2D" parent="Area2D"]
position = Vector2(0, 9.5)
shape = SubResource("RectangleShape2D_c6ukx")
[node name="CollisionPolygon2D" type="CollisionPolygon2D" parent="."]
polygon = PackedVector2Array(-16, 16, -12, 12, 12, 12, 16, 16)
[node name="Sprite2D" type="Sprite2D" parent="."]
texture = ExtResource("1_st48m")
hframes = 2
frame = 1
[node name="AnimationPlayer" type="AnimationPlayer" parent="."]
libraries = {
"": SubResource("AnimationLibrary_usrhb")
}
autoplay = "Enable"
[connection signal="body_entered" from="Area2D" to="." method="_on_body_entered"]
[connection signal="body_exited" from="Area2D" to="." method="_on_body_exited"]

View file

@ -1,13 +1,9 @@
[gd_scene load_steps=4 format=3 uid="uid://br6fngf5208j0"]
[gd_scene load_steps=3 format=3 uid="uid://br6fngf5208j0"]
[ext_resource type="Script" path="res://scripts/resizable_block.gd" id="1_j40bu"]
[ext_resource type="Texture2D" uid="uid://bb8vdlgwpj8oc" path="res://textures/antivirus-block-big.png" id="3_lb374"]
[sub_resource type="RectangleShape2D" id="RectangleShape2D_sgemy"]
size = Vector2(59, 59)
[node name="Block" type="StaticBody2D"]
collision_layer = 17
collision_mask = 22
input_pickable = true
script = ExtResource("1_j40bu")
@ -15,7 +11,7 @@ script = ExtResource("1_j40bu")
[node name="Sprite2D" type="Sprite2D" parent="."]
texture = ExtResource("3_lb374")
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
shape = SubResource("RectangleShape2D_sgemy")
[node name="CollisionPolygon2D" type="CollisionPolygon2D" parent="."]
polygon = PackedVector2Array(-32, -20, -28, -20, -28, -24, -24, -24, -24, -28, -20, -28, -20, -32, 20, -32, 20, -28, 24, -28, 24, -24, 28, -24, 28, -20, 32, -20, 32, 20, 28, 20, 28, 24, 24, 24, 24, 28, 20, 28, 20, 32, -20, 32, -20, 28, -24, 28, -24, 24, -28, 24, -28, 20, -32, 20)
[connection signal="input_event" from="." to="." method="_on_input_event"]