added pipes and interact blocks

This commit is contained in:
Jonas Braus
2024-07-28 20:39:02 +02:00
parent 083c1b98ec
commit f9fdbb4612
11 changed files with 469 additions and 17 deletions
+46
View File
@@ -0,0 +1,46 @@
[gd_scene load_steps=7 format=3 uid="uid://b6piduuvusiix"]
[ext_resource type="Texture2D" uid="uid://chrld8oybp4me" path="res://assets/bg-1-1.png" id="1_4h0ce"]
[ext_resource type="Script" path="res://scripts/destroyblock.gd" id="1_a8383"]
[sub_resource type="AtlasTexture" id="AtlasTexture_nbg0j"]
atlas = ExtResource("1_4h0ce")
region = Rect2(320, 144, 16, 16)
[sub_resource type="SpriteFrames" id="SpriteFrames_r70hc"]
animations = [{
"frames": [{
"duration": 1.0,
"texture": SubResource("AtlasTexture_nbg0j")
}],
"loop": true,
"name": &"default",
"speed": 5.0
}]
[sub_resource type="RectangleShape2D" id="RectangleShape2D_i07jg"]
size = Vector2(16, 16)
[sub_resource type="RectangleShape2D" id="RectangleShape2D_r8vfl"]
size = Vector2(8, 1)
[node name="destroyblock" type="RigidBody2D"]
gravity_scale = 0.0
script = ExtResource("1_a8383")
[node name="AnimatedSprite2D" type="AnimatedSprite2D" parent="."]
position = Vector2(8, -8)
sprite_frames = SubResource("SpriteFrames_r70hc")
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
position = Vector2(8, -8)
shape = SubResource("RectangleShape2D_i07jg")
[node name="activate" type="Area2D" parent="."]
collision_mask = 2
[node name="CollisionShape2D" type="CollisionShape2D" parent="activate"]
position = Vector2(8, 0.5)
shape = SubResource("RectangleShape2D_r8vfl")
[connection signal="body_entered" from="activate" to="." method="_on_activate_body_entered"]
+73
View File
@@ -0,0 +1,73 @@
[gd_scene load_steps=10 format=3 uid="uid://d25ukpt8ot8xv"]
[ext_resource type="Script" path="res://scripts/itemblock.gd" id="2_fn5hi"]
[ext_resource type="Texture2D" uid="uid://dth47lmb44qk8" path="res://assets/items.png" id="2_t1ko6"]
[sub_resource type="AtlasTexture" id="AtlasTexture_lo6hv"]
atlas = ExtResource("2_t1ko6")
region = Rect2(4, 4, 16, 16)
[sub_resource type="AtlasTexture" id="AtlasTexture_ghd0r"]
atlas = ExtResource("2_t1ko6")
region = Rect2(34, 4, 16, 16)
[sub_resource type="AtlasTexture" id="AtlasTexture_5py80"]
atlas = ExtResource("2_t1ko6")
region = Rect2(64, 4, 16, 16)
[sub_resource type="AtlasTexture" id="AtlasTexture_4m3oc"]
atlas = ExtResource("2_t1ko6")
region = Rect2(4, 4, 16, 16)
[sub_resource type="SpriteFrames" id="SpriteFrames_r54gk"]
animations = [{
"frames": [{
"duration": 1.0,
"texture": SubResource("AtlasTexture_lo6hv")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_ghd0r")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_5py80")
}],
"loop": false,
"name": &"destroy",
"speed": 10.0
}, {
"frames": [{
"duration": 1.0,
"texture": SubResource("AtlasTexture_4m3oc")
}],
"loop": true,
"name": &"idle",
"speed": 5.0
}]
[sub_resource type="RectangleShape2D" id="RectangleShape2D_4kmo0"]
size = Vector2(16, 16)
[sub_resource type="RectangleShape2D" id="RectangleShape2D_enc16"]
size = Vector2(8, 1)
[node name="itemblock" type="RigidBody2D"]
gravity_scale = 0.0
script = ExtResource("2_fn5hi")
[node name="AnimatedSprite2D" type="AnimatedSprite2D" parent="."]
position = Vector2(8, -8)
sprite_frames = SubResource("SpriteFrames_r54gk")
animation = &"destroy"
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
position = Vector2(8, -8)
shape = SubResource("RectangleShape2D_4kmo0")
[node name="activate" type="Area2D" parent="."]
collision_mask = 2
[node name="CollisionShape2D" type="CollisionShape2D" parent="activate"]
position = Vector2(8, 0.5)
shape = SubResource("RectangleShape2D_enc16")
[connection signal="body_entered" from="activate" to="." method="_on_activate_body_entered"]
+155 -14
View File
File diff suppressed because one or more lines are too long
+14
View File
@@ -0,0 +1,14 @@
[gd_scene load_steps=3 format=3 uid="uid://be832pldgbeyk"]
[ext_resource type="Script" path="res://scripts/pipe.gd" id="1_akqs5"]
[sub_resource type="RectangleShape2D" id="RectangleShape2D_5w6v5"]
size = Vector2(30, 1)
[node name="pipe" type="Area2D"]
collision_layer = 4
script = ExtResource("1_akqs5")
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
position = Vector2(16, -0.5)
shape = SubResource("RectangleShape2D_5w6v5")
+60 -1
View File
@@ -1,4 +1,4 @@
[gd_scene load_steps=11 format=3 uid="uid://dk1aby88pygtr"]
[gd_scene load_steps=13 format=3 uid="uid://dk1aby88pygtr"]
[ext_resource type="Script" path="res://scripts/player.gd" id="1_lm7ix"]
[ext_resource type="Texture2D" uid="uid://dhw3lpuskbvku" path="res://assets/mario-luigi-4.png" id="1_w3chr"]
@@ -72,10 +72,33 @@ animations = [{
radius = 6.0
height = 16.0
[sub_resource type="RectangleShape2D" id="RectangleShape2D_sqgi2"]
size = Vector2(8, 1)
[sub_resource type="RectangleShape2D" id="RectangleShape2D_okc7h"]
size = Vector2(1, 2)
[node name="player" type="CharacterBody2D"]
position = Vector2(0, -10)
collision_layer = 2
script = ExtResource("1_lm7ix")
[node name="Camera2D" type="Camera2D" parent="."]
position = Vector2(35, 0)
zoom = Vector2(3, 3)
limit_left = -160
limit_bottom = 32
position_smoothing_enabled = true
[node name="ColorRect" type="ColorRect" parent="Camera2D"]
visible = false
z_index = 10
offset_left = -3995.0
offset_top = -1678.0
offset_right = 3965.0
offset_bottom = 1594.0
color = Color(0, 0, 0, 1)
[node name="AnimatedSprite2D" type="AnimatedSprite2D" parent="."]
position = Vector2(0, 2)
sprite_frames = SubResource("SpriteFrames_l5s58")
@@ -84,3 +107,39 @@ animation = &"jump"
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
position = Vector2(0, 2)
shape = SubResource("CapsuleShape2D_4sl4a")
[node name="pipedetector_ground" type="Area2D" parent="."]
collision_mask = 4
[node name="CollisionShape2D" type="CollisionShape2D" parent="pipedetector_ground"]
position = Vector2(0, 10.5)
shape = SubResource("RectangleShape2D_sqgi2")
[node name="pipedetector_right" type="Area2D" parent="."]
collision_mask = 4
[node name="CollisionShape2D" type="CollisionShape2D" parent="pipedetector_right"]
position = Vector2(6.5, -2)
shape = SubResource("RectangleShape2D_okc7h")
[node name="pipedetector_left" type="Area2D" parent="."]
position = Vector2(-13, -4)
collision_mask = 4
[node name="CollisionShape2D" type="CollisionShape2D" parent="pipedetector_left"]
position = Vector2(6.5, 2)
shape = SubResource("RectangleShape2D_okc7h")
[node name="pipe_timer" type="Timer" parent="."]
wait_time = 2.0
one_shot = true
[node name="pipe_timer_half" type="Timer" parent="."]
one_shot = true
[connection signal="area_entered" from="pipedetector_ground" to="." method="_on_pipedetector_area_entered"]
[connection signal="area_exited" from="pipedetector_ground" to="." method="_on_pipedetector_area_exited"]
[connection signal="area_entered" from="pipedetector_right" to="." method="_on_pipedetector_right_area_entered"]
[connection signal="area_exited" from="pipedetector_right" to="." method="_on_pipedetector_right_area_exited"]
[connection signal="timeout" from="pipe_timer" to="." method="_on_pipe_timer_timeout"]
[connection signal="timeout" from="pipe_timer_half" to="." method="_on_pipe_timer_half_timeout"]