added fireballs

This commit is contained in:
Jonas Braus
2024-07-29 23:30:26 +02:00
parent 3a6f8517c0
commit 85736f82e0
19 changed files with 365 additions and 39 deletions
Binary file not shown.

Before

Width:  |  Height:  |  Size: 50 KiB

After

Width:  |  Height:  |  Size: 49 KiB

+5
View File
@@ -59,6 +59,11 @@ crawl={
, Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":-1,"axis":1,"axis_value":1.0,"script":null) , Object(InputEventJoypadMotion,"resource_local_to_scene":false,"resource_name":"","device":-1,"axis":1,"axis_value":1.0,"script":null)
] ]
} }
flower={
"deadzone": 0.5,
"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":69,"key_label":0,"unicode":101,"echo":false,"script":null)
]
}
[input_devices] [input_devices]
@@ -1,7 +1,7 @@
[gd_scene load_steps=12 format=3 uid="uid://b6piduuvusiix"] [gd_scene load_steps=12 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="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"] [ext_resource type="Script" path="res://scripts/blocks/destroyblock.gd" id="1_a8383"]
[ext_resource type="AudioStream" uid="uid://dkb0efnhs6mrj" path="res://assets/sounds/NES - Super Mario Bros - Sound Effects/Super Mario Bros 1 and 2(JP)/Break.wav" id="3_bsm87"] [ext_resource type="AudioStream" uid="uid://dkb0efnhs6mrj" path="res://assets/sounds/NES - Super Mario Bros - Sound Effects/Super Mario Bros 1 and 2(JP)/Break.wav" id="3_bsm87"]
[sub_resource type="AtlasTexture" id="AtlasTexture_nbg0j"] [sub_resource type="AtlasTexture" id="AtlasTexture_nbg0j"]
@@ -1,6 +1,6 @@
[gd_scene load_steps=10 format=3 uid="uid://d25ukpt8ot8xv"] [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="Script" path="res://scripts/blocks/itemblock.gd" id="2_fn5hi"]
[ext_resource type="Texture2D" uid="uid://dth47lmb44qk8" path="res://assets/items.png" id="2_t1ko6"] [ext_resource type="Texture2D" uid="uid://dth47lmb44qk8" path="res://assets/items.png" id="2_t1ko6"]
[sub_resource type="AtlasTexture" id="AtlasTexture_lo6hv"] [sub_resource type="AtlasTexture" id="AtlasTexture_lo6hv"]
@@ -1,7 +1,7 @@
[gd_scene load_steps=10 format=3 uid="uid://cwviqxncs4fom"] [gd_scene load_steps=10 format=3 uid="uid://cwviqxncs4fom"]
[ext_resource type="Texture2D" uid="uid://ddl5f3lldrp2n" path="res://assets/enemies.png" id="1_fe7l6"] [ext_resource type="Texture2D" uid="uid://ddl5f3lldrp2n" path="res://assets/enemies.png" id="1_fe7l6"]
[ext_resource type="Script" path="res://scripts/gumba.gd" id="1_o30u3"] [ext_resource type="Script" path="res://scripts/enemies/gumba.gd" id="1_o30u3"]
[ext_resource type="AudioStream" uid="uid://bh8t167vl6j2n" path="res://assets/sounds/NES - Super Mario Bros - Sound Effects/Super Mario Bros 1 and 2(JP)/Kick.wav" id="3_v1fjb"] [ext_resource type="AudioStream" uid="uid://bh8t167vl6j2n" path="res://assets/sounds/NES - Super Mario Bros - Sound Effects/Super Mario Bros 1 and 2(JP)/Kick.wav" id="3_v1fjb"]
[sub_resource type="AtlasTexture" id="AtlasTexture_srbv5"] [sub_resource type="AtlasTexture" id="AtlasTexture_srbv5"]
@@ -45,7 +45,7 @@ radius = 8.0
size = Vector2(10, 0.5) size = Vector2(10, 0.5)
[node name="Gumba" type="RigidBody2D"] [node name="Gumba" type="RigidBody2D"]
collision_layer = 8 collision_layer = 128
lock_rotation = true lock_rotation = true
script = ExtResource("1_o30u3") script = ExtResource("1_o30u3")
+3 -3
View File
@@ -1,7 +1,7 @@
[gd_scene load_steps=13 format=3 uid="uid://nm5keea43u56"] [gd_scene load_steps=13 format=3 uid="uid://nm5keea43u56"]
[ext_resource type="Texture2D" uid="uid://dth47lmb44qk8" path="res://assets/items.png" id="1_lffao"] [ext_resource type="Texture2D" uid="uid://dth47lmb44qk8" path="res://assets/items.png" id="1_lffao"]
[ext_resource type="Script" path="res://scripts/coin.gd" id="1_qn7es"] [ext_resource type="Script" path="res://scripts/items/coin.gd" id="1_shvw0"]
[ext_resource type="AudioStream" uid="uid://dkfpfaqxyvcew" path="res://assets/sounds/NES - Super Mario Bros - Sound Effects/Super Mario Bros 1 and 2(JP)/Coin.wav" id="3_ioelm"] [ext_resource type="AudioStream" uid="uid://dkfpfaqxyvcew" path="res://assets/sounds/NES - Super Mario Bros - Sound Effects/Super Mario Bros 1 and 2(JP)/Coin.wav" id="3_ioelm"]
[sub_resource type="AtlasTexture" id="AtlasTexture_7xy4l"] [sub_resource type="AtlasTexture" id="AtlasTexture_7xy4l"]
@@ -37,7 +37,7 @@ animations = [{
}], }],
"loop": true, "loop": true,
"name": &"idle", "name": &"idle",
"speed": 5.0 "speed": 10.0
}] }]
[sub_resource type="CircleShape2D" id="CircleShape2D_vpcnk"] [sub_resource type="CircleShape2D" id="CircleShape2D_vpcnk"]
@@ -142,7 +142,7 @@ _data = {
[node name="Coin" type="Area2D"] [node name="Coin" type="Area2D"]
collision_mask = 2 collision_mask = 2
script = ExtResource("1_qn7es") script = ExtResource("1_shvw0")
[node name="AnimatedSprite2D" type="AnimatedSprite2D" parent="."] [node name="AnimatedSprite2D" type="AnimatedSprite2D" parent="."]
position = Vector2(8, -8) position = Vector2(8, -8)
+142
View File
@@ -0,0 +1,142 @@
[gd_scene load_steps=13 format=3 uid="uid://bp71ntkh281k5"]
[ext_resource type="Texture2D" uid="uid://dth47lmb44qk8" path="res://assets/items.png" id="1_2qvvh"]
[ext_resource type="Script" path="res://scripts/items/fire_flower.gd" id="1_mpyyo"]
[ext_resource type="AudioStream" uid="uid://dr8w21sjl0a7" path="res://assets/sounds/NES - Super Mario Bros - Sound Effects/Super Mario Bros 1 and 2(JP)/Powerup.wav" id="3_vbdsa"]
[sub_resource type="AtlasTexture" id="AtlasTexture_jlv6x"]
atlas = ExtResource("1_2qvvh")
region = Rect2(4, 64, 16, 16)
[sub_resource type="AtlasTexture" id="AtlasTexture_flc5q"]
atlas = ExtResource("1_2qvvh")
region = Rect2(34, 64, 16, 16)
[sub_resource type="AtlasTexture" id="AtlasTexture_ftlk4"]
atlas = ExtResource("1_2qvvh")
region = Rect2(64, 64, 16, 16)
[sub_resource type="AtlasTexture" id="AtlasTexture_t6dyx"]
atlas = ExtResource("1_2qvvh")
region = Rect2(94, 64, 16, 16)
[sub_resource type="SpriteFrames" id="SpriteFrames_7uuxh"]
animations = [{
"frames": [{
"duration": 1.0,
"texture": SubResource("AtlasTexture_jlv6x")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_flc5q")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_ftlk4")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_t6dyx")
}],
"loop": true,
"name": &"default",
"speed": 10.0
}]
[sub_resource type="CircleShape2D" id="CircleShape2D_r8tpx"]
radius = 9.0
[sub_resource type="Animation" id="Animation_3a161"]
length = 0.001
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath("AnimatedSprite2D:visible")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 1,
"values": [true]
}
tracks/1/type = "value"
tracks/1/imported = false
tracks/1/enabled = true
tracks/1/path = NodePath("AudioStreamPlayer2D:playing")
tracks/1/interp = 1
tracks/1/loop_wrap = true
tracks/1/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 1,
"values": [false]
}
[sub_resource type="Animation" id="Animation_4xypy"]
resource_name = "pickup"
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath("AnimatedSprite2D:visible")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0.1),
"transitions": PackedFloat32Array(1),
"update": 1,
"values": [false]
}
tracks/1/type = "value"
tracks/1/imported = false
tracks/1/enabled = true
tracks/1/path = NodePath("AudioStreamPlayer2D:playing")
tracks/1/interp = 1
tracks/1/loop_wrap = true
tracks/1/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 1,
"values": [true]
}
tracks/2/type = "method"
tracks/2/imported = false
tracks/2/enabled = true
tracks/2/path = NodePath(".")
tracks/2/interp = 1
tracks/2/loop_wrap = true
tracks/2/keys = {
"times": PackedFloat32Array(1),
"transitions": PackedFloat32Array(1),
"values": [{
"args": [],
"method": &"queue_free"
}]
}
[sub_resource type="AnimationLibrary" id="AnimationLibrary_duoc6"]
_data = {
"RESET": SubResource("Animation_3a161"),
"pickup": SubResource("Animation_4xypy")
}
[node name="FireFlower" type="Area2D"]
collision_layer = 8
collision_mask = 2
script = ExtResource("1_mpyyo")
[node name="AnimatedSprite2D" type="AnimatedSprite2D" parent="."]
position = Vector2(8, -8)
sprite_frames = SubResource("SpriteFrames_7uuxh")
autoplay = "default"
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
position = Vector2(8, -8)
shape = SubResource("CircleShape2D_r8tpx")
[node name="AnimationPlayer" type="AnimationPlayer" parent="."]
libraries = {
"": SubResource("AnimationLibrary_duoc6")
}
[node name="AudioStreamPlayer2D" type="AudioStreamPlayer2D" parent="."]
stream = ExtResource("3_vbdsa")
[connection signal="body_entered" from="." to="." method="_on_body_entered"]
+62
View File
@@ -0,0 +1,62 @@
[gd_scene load_steps=9 format=3 uid="uid://beaktq6mygp6c"]
[ext_resource type="Script" path="res://scripts/items/fireball.gd" id="1_c103u"]
[ext_resource type="Texture2D" uid="uid://ddl5f3lldrp2n" path="res://assets/enemies.png" id="1_sy4od"]
[sub_resource type="PhysicsMaterial" id="PhysicsMaterial_27hkc"]
bounce = 0.7
[sub_resource type="AtlasTexture" id="AtlasTexture_pjn1s"]
atlas = ExtResource("1_sy4od")
region = Rect2(364, 188, 8, 8)
[sub_resource type="SpriteFrames" id="SpriteFrames_unbxs"]
animations = [{
"frames": [{
"duration": 1.0,
"texture": SubResource("AtlasTexture_pjn1s")
}],
"loop": true,
"name": &"default",
"speed": 5.0
}]
[sub_resource type="CircleShape2D" id="CircleShape2D_pwt6i"]
radius = 5.09902
[sub_resource type="CircleShape2D" id="CircleShape2D_87wnf"]
radius = 6.0
[sub_resource type="CircleShape2D" id="CircleShape2D_ly4gs"]
radius = 5.0
[node name="Fireball" type="RigidBody2D"]
collision_layer = 8
physics_material_override = SubResource("PhysicsMaterial_27hkc")
can_sleep = false
script = ExtResource("1_c103u")
[node name="AnimatedSprite2D" type="AnimatedSprite2D" parent="."]
sprite_frames = SubResource("SpriteFrames_unbxs")
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
shape = SubResource("CircleShape2D_pwt6i")
[node name="Timer" type="Timer" parent="."]
wait_time = 2.0
one_shot = true
[node name="CollCount" type="Area2D" parent="."]
[node name="CollisionShape2D" type="CollisionShape2D" parent="CollCount"]
shape = SubResource("CircleShape2D_87wnf")
[node name="EnemieDie" type="Area2D" parent="."]
collision_mask = 128
[node name="CollisionShape2D" type="CollisionShape2D" parent="EnemieDie"]
shape = SubResource("CircleShape2D_ly4gs")
[connection signal="timeout" from="Timer" to="." method="_on_timer_timeout"]
[connection signal="body_entered" from="CollCount" to="." method="_on_area_2d_body_entered"]
[connection signal="body_entered" from="EnemieDie" to="." method="_on_enemie_die_body_entered"]
@@ -1,6 +1,6 @@
[gd_scene load_steps=11 format=3 uid="uid://b4dp88urmm7g8"] [gd_scene load_steps=11 format=3 uid="uid://b4dp88urmm7g8"]
[ext_resource type="Script" path="res://scripts/mushroom.gd" id="1_5wbjm"] [ext_resource type="Script" path="res://scripts/items/mushroom.gd" id="1_qo5bm"]
[ext_resource type="Texture2D" uid="uid://dth47lmb44qk8" path="res://assets/items.png" id="1_tsecc"] [ext_resource type="Texture2D" uid="uid://dth47lmb44qk8" path="res://assets/items.png" id="1_tsecc"]
[ext_resource type="AudioStream" uid="uid://dr8w21sjl0a7" path="res://assets/sounds/NES - Super Mario Bros - Sound Effects/Super Mario Bros 1 and 2(JP)/Powerup.wav" id="3_ad473"] [ext_resource type="AudioStream" uid="uid://dr8w21sjl0a7" path="res://assets/sounds/NES - Super Mario Bros - Sound Effects/Super Mario Bros 1 and 2(JP)/Powerup.wav" id="3_ad473"]
@@ -102,7 +102,7 @@ _data = {
[node name="mushroom" type="RigidBody2D"] [node name="mushroom" type="RigidBody2D"]
collision_layer = 8 collision_layer = 8
lock_rotation = true lock_rotation = true
script = ExtResource("1_5wbjm") script = ExtResource("1_qo5bm")
[node name="AnimatedSprite2D" type="AnimatedSprite2D" parent="."] [node name="AnimatedSprite2D" type="AnimatedSprite2D" parent="."]
position = Vector2(8, -8) position = Vector2(8, -8)
+21 -20
View File
@@ -1,13 +1,14 @@
[gd_scene load_steps=15 format=3 uid="uid://dv50be68omp73"] [gd_scene load_steps=16 format=3 uid="uid://dv50be68omp73"]
[ext_resource type="Texture2D" uid="uid://chrld8oybp4me" path="res://assets/bg-1-1.png" id="1_rxc3r"] [ext_resource type="Texture2D" uid="uid://chrld8oybp4me" path="res://assets/bg-1-1.png" id="1_rxc3r"]
[ext_resource type="PackedScene" uid="uid://dk1aby88pygtr" path="res://scenes/player.tscn" id="2_ru48y"] [ext_resource type="PackedScene" uid="uid://dk1aby88pygtr" path="res://scenes/player.tscn" id="2_ru48y"]
[ext_resource type="PackedScene" uid="uid://d25ukpt8ot8xv" path="res://scenes/itemblock.tscn" id="3_fmbwm"] [ext_resource type="PackedScene" uid="uid://d25ukpt8ot8xv" path="res://scenes/blocks/itemblock.tscn" id="3_fmbwm"]
[ext_resource type="PackedScene" uid="uid://b6piduuvusiix" path="res://scenes/destroyblock.tscn" id="4_4f23w"] [ext_resource type="PackedScene" uid="uid://b6piduuvusiix" path="res://scenes/blocks/destroyblock.tscn" id="4_4f23w"]
[ext_resource type="PackedScene" uid="uid://bp71ntkh281k5" path="res://scenes/items/fire_flower.tscn" id="4_qmept"]
[ext_resource type="PackedScene" uid="uid://be832pldgbeyk" path="res://scenes/pipe.tscn" id="5_31d8i"] [ext_resource type="PackedScene" uid="uid://be832pldgbeyk" path="res://scenes/pipe.tscn" id="5_31d8i"]
[ext_resource type="PackedScene" uid="uid://nm5keea43u56" path="res://scenes/coin.tscn" id="6_evydd"] [ext_resource type="PackedScene" uid="uid://nm5keea43u56" path="res://scenes/items/coin.tscn" id="6_evydd"]
[ext_resource type="PackedScene" uid="uid://b4dp88urmm7g8" path="res://scenes/mushroom.tscn" id="7_rk0p2"] [ext_resource type="PackedScene" uid="uid://b4dp88urmm7g8" path="res://scenes/items/mushroom.tscn" id="7_rk0p2"]
[ext_resource type="PackedScene" uid="uid://cwviqxncs4fom" path="res://scenes/gumba.tscn" id="8_be76n"] [ext_resource type="PackedScene" uid="uid://cwviqxncs4fom" path="res://scenes/enemies/gumba.tscn" id="8_be76n"]
[ext_resource type="AudioStream" uid="uid://cdtrw675os7dh" path="res://assets/sounds/01. Ground Theme.mp3" id="9_xkthi"] [ext_resource type="AudioStream" uid="uid://cdtrw675os7dh" path="res://assets/sounds/01. Ground Theme.mp3" id="9_xkthi"]
[ext_resource type="FontFile" uid="uid://cpwx7datjer6s" path="res://assets/PixelOperator8.ttf" id="10_b277n"] [ext_resource type="FontFile" uid="uid://cpwx7datjer6s" path="res://assets/PixelOperator8.ttf" id="10_b277n"]
@@ -19101,7 +19102,7 @@ hit_object = ExtResource("6_evydd")
[node name="itemblock5" parent="interactable_blocks" instance=ExtResource("3_fmbwm")] [node name="itemblock5" parent="interactable_blocks" instance=ExtResource("3_fmbwm")]
position = Vector2(1168, -48) position = Vector2(1168, -48)
hit_object = ExtResource("6_evydd") hit_object = ExtResource("4_qmept")
[node name="destroyblock4" parent="interactable_blocks" instance=ExtResource("4_4f23w")] [node name="destroyblock4" parent="interactable_blocks" instance=ExtResource("4_4f23w")]
position = Vector2(1152, -48) position = Vector2(1152, -48)
@@ -19169,7 +19170,7 @@ hit_object = ExtResource("6_evydd")
[node name="itemblock10" parent="interactable_blocks" instance=ExtResource("3_fmbwm")] [node name="itemblock10" parent="interactable_blocks" instance=ExtResource("3_fmbwm")]
position = Vector2(1664, -112) position = Vector2(1664, -112)
hit_object = ExtResource("7_rk0p2") hit_object = ExtResource("6_evydd")
[node name="destroyblock20" parent="interactable_blocks" instance=ExtResource("4_4f23w")] [node name="destroyblock20" parent="interactable_blocks" instance=ExtResource("4_4f23w")]
position = Vector2(1792, -48) position = Vector2(1792, -48)
@@ -19326,6 +19327,18 @@ position = Vector2(1120, 0)
[node name="Gumba5" parent="Enemies" instance=ExtResource("8_be76n")] [node name="Gumba5" parent="Enemies" instance=ExtResource("8_be76n")]
position = Vector2(1152, 0) position = Vector2(1152, 0)
[node name="Gumba6" parent="Enemies" instance=ExtResource("8_be76n")]
position = Vector2(1472, 0)
[node name="Gumba7" parent="Enemies" instance=ExtResource("8_be76n")]
position = Vector2(1648, 0)
[node name="Gumba8" parent="Enemies" instance=ExtResource("8_be76n")]
position = Vector2(2672, 0)
[node name="Gumba9" parent="Enemies" instance=ExtResource("8_be76n")]
position = Vector2(2752, 0)
[node name="Pipes" type="Node" parent="."] [node name="Pipes" type="Node" parent="."]
[node name="pipe" parent="Pipes" instance=ExtResource("5_31d8i")] [node name="pipe" parent="Pipes" instance=ExtResource("5_31d8i")]
@@ -19363,15 +19376,3 @@ theme_override_fonts/font = ExtResource("10_b277n")
text = "Tap Right To Jump" text = "Tap Right To Jump"
horizontal_alignment = 1 horizontal_alignment = 1
vertical_alignment = 1 vertical_alignment = 1
[node name="Gumba" parent="." instance=ExtResource("8_be76n")]
position = Vector2(1472, 0)
[node name="Gumba2" parent="." instance=ExtResource("8_be76n")]
position = Vector2(1648, 0)
[node name="Gumba3" parent="." instance=ExtResource("8_be76n")]
position = Vector2(2672, 0)
[node name="Gumba4" parent="." instance=ExtResource("8_be76n")]
position = Vector2(2752, 0)
+54 -2
View File
@@ -1,7 +1,8 @@
[gd_scene load_steps=22 format=3 uid="uid://dk1aby88pygtr"] [gd_scene load_steps=28 format=3 uid="uid://dk1aby88pygtr"]
[ext_resource type="Script" path="res://scripts/player.gd" id="1_lm7ix"] [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"] [ext_resource type="Texture2D" uid="uid://dhw3lpuskbvku" path="res://assets/mario-luigi-4.png" id="1_w3chr"]
[ext_resource type="PackedScene" uid="uid://beaktq6mygp6c" path="res://scenes/items/fireball.tscn" id="2_owoxk"]
[ext_resource type="FontFile" uid="uid://cpwx7datjer6s" path="res://assets/PixelOperator8.ttf" id="3_mkgvb"] [ext_resource type="FontFile" uid="uid://cpwx7datjer6s" path="res://assets/PixelOperator8.ttf" id="3_mkgvb"]
[ext_resource type="Texture2D" uid="uid://d0xxlo60h1d7i" path="res://assets/coinlabel.png" id="4_o0q77"] [ext_resource type="Texture2D" uid="uid://d0xxlo60h1d7i" path="res://assets/coinlabel.png" id="4_o0q77"]
[ext_resource type="AudioStream" uid="uid://cbs4okawh444d" path="res://assets/sounds/NES - Super Mario Bros - Sound Effects/Super Mario Bros 1 and 2(JP)/Warp.wav" id="5_kvw73"] [ext_resource type="AudioStream" uid="uid://cbs4okawh444d" path="res://assets/sounds/NES - Super Mario Bros - Sound Effects/Super Mario Bros 1 and 2(JP)/Warp.wav" id="5_kvw73"]
@@ -19,6 +20,10 @@ region = Rect2(80, 34, 16, 16)
atlas = ExtResource("1_w3chr") atlas = ExtResource("1_w3chr")
region = Rect2(80, 1, 16, 32) region = Rect2(80, 1, 16, 32)
[sub_resource type="AtlasTexture" id="AtlasTexture_kxd3p"]
atlas = ExtResource("1_w3chr")
region = Rect2(80, 129, 16, 32)
[sub_resource type="AtlasTexture" id="AtlasTexture_dmbgr"] [sub_resource type="AtlasTexture" id="AtlasTexture_dmbgr"]
atlas = ExtResource("1_w3chr") atlas = ExtResource("1_w3chr")
region = Rect2(165, 34, 16, 16) region = Rect2(165, 34, 16, 16)
@@ -27,6 +32,10 @@ region = Rect2(165, 34, 16, 16)
atlas = ExtResource("1_w3chr") atlas = ExtResource("1_w3chr")
region = Rect2(165, 1, 16, 32) region = Rect2(165, 1, 16, 32)
[sub_resource type="AtlasTexture" id="AtlasTexture_npe6k"]
atlas = ExtResource("1_w3chr")
region = Rect2(165, 129, 16, 32)
[sub_resource type="AtlasTexture" id="AtlasTexture_jb1pe"] [sub_resource type="AtlasTexture" id="AtlasTexture_jb1pe"]
atlas = ExtResource("1_w3chr") atlas = ExtResource("1_w3chr")
region = Rect2(97, 34, 16, 16) region = Rect2(97, 34, 16, 16)
@@ -51,6 +60,18 @@ region = Rect2(114, 1, 16, 32)
atlas = ExtResource("1_w3chr") atlas = ExtResource("1_w3chr")
region = Rect2(131, 1, 16, 32) region = Rect2(131, 1, 16, 32)
[sub_resource type="AtlasTexture" id="AtlasTexture_iljl6"]
atlas = ExtResource("1_w3chr")
region = Rect2(97, 129, 16, 32)
[sub_resource type="AtlasTexture" id="AtlasTexture_7pcnf"]
atlas = ExtResource("1_w3chr")
region = Rect2(114, 129, 16, 32)
[sub_resource type="AtlasTexture" id="AtlasTexture_jva7o"]
atlas = ExtResource("1_w3chr")
region = Rect2(131, 129, 16, 32)
[sub_resource type="SpriteFrames" id="SpriteFrames_l5s58"] [sub_resource type="SpriteFrames" id="SpriteFrames_l5s58"]
animations = [{ animations = [{
"frames": [{ "frames": [{
@@ -79,6 +100,14 @@ animations = [{
}, { }, {
"frames": [{ "frames": [{
"duration": 1.0, "duration": 1.0,
"texture": SubResource("AtlasTexture_kxd3p")
}],
"loop": true,
"name": &"idle_flower",
"speed": 5.0
}, {
"frames": [{
"duration": 1.0,
"texture": SubResource("AtlasTexture_dmbgr") "texture": SubResource("AtlasTexture_dmbgr")
}], }],
"loop": true, "loop": true,
@@ -95,6 +124,14 @@ animations = [{
}, { }, {
"frames": [{ "frames": [{
"duration": 1.0, "duration": 1.0,
"texture": SubResource("AtlasTexture_npe6k")
}],
"loop": true,
"name": &"jump_flower",
"speed": 5.0
}, {
"frames": [{
"duration": 1.0,
"texture": SubResource("AtlasTexture_jb1pe") "texture": SubResource("AtlasTexture_jb1pe")
}, { }, {
"duration": 1.0, "duration": 1.0,
@@ -120,6 +157,20 @@ animations = [{
"loop": true, "loop": true,
"name": &"run_big", "name": &"run_big",
"speed": 10.0 "speed": 10.0
}, {
"frames": [{
"duration": 1.0,
"texture": SubResource("AtlasTexture_iljl6")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_7pcnf")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_jva7o")
}],
"loop": true,
"name": &"run_flower",
"speed": 10.0
}] }]
[sub_resource type="CapsuleShape2D" id="CapsuleShape2D_4sl4a"] [sub_resource type="CapsuleShape2D" id="CapsuleShape2D_4sl4a"]
@@ -136,6 +187,7 @@ size = Vector2(1, 2)
position = Vector2(0, -10) position = Vector2(0, -10)
collision_layer = 2 collision_layer = 2
script = ExtResource("1_lm7ix") script = ExtResource("1_lm7ix")
fireball_prefab = ExtResource("2_owoxk")
[node name="Camera2D" type="Camera2D" parent="."] [node name="Camera2D" type="Camera2D" parent="."]
position = Vector2(35, 0) position = Vector2(35, 0)
@@ -156,7 +208,7 @@ color = Color(0, 0, 0, 1)
[node name="AnimatedSprite2D" type="AnimatedSprite2D" parent="."] [node name="AnimatedSprite2D" type="AnimatedSprite2D" parent="."]
position = Vector2(0, 2) position = Vector2(0, 2)
sprite_frames = SubResource("SpriteFrames_l5s58") sprite_frames = SubResource("SpriteFrames_l5s58")
animation = &"idle_big" animation = &"run_flower"
[node name="CollisionShape2D" type="CollisionShape2D" parent="."] [node name="CollisionShape2D" type="CollisionShape2D" parent="."]
position = Vector2(0, 2) position = Vector2(0, 2)
@@ -19,4 +19,4 @@ func _on_activate_body_entered(body):
var instance = hit_object.instantiate() var instance = hit_object.instantiate()
add_child(instance) add_child(instance)
instance.position.y -= 17 instance.position.y -= 16
+6
View File
@@ -0,0 +1,6 @@
extends Area2D
@onready var animation_player = $AnimationPlayer
func _on_body_entered(body):
body.flower()
animation_player.play("pickup")
+23
View File
@@ -0,0 +1,23 @@
extends RigidBody2D
@onready var timer = $Timer
var enter_count = 0
# Called when the node enters the scene tree for the first time.
func _ready():
timer.start()
# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta):
pass
func _on_timer_timeout():
queue_free()
func _on_area_2d_body_entered(body):
enter_count += 1
if enter_count > 2:
queue_free()
func _on_enemie_die_body_entered(body):
body.f_die()
queue_free()
+42 -7
View File
@@ -24,21 +24,28 @@ var coins = 0
var gravity = ProjectSettings.get_setting("physics/2d/default_gravity") var gravity = ProjectSettings.get_setting("physics/2d/default_gravity")
var on_pause = false var on_pause = false
var is_big = false var is_big = false
var is_flower = false
# touch controls # touch controls
var touch_anchor = Vector2.ZERO var touch_anchor = Vector2.ZERO
var jump = false var jump = false
var crawl = false var crawl = false
var fire = false
var toucht_velocity = Vector2.ZERO var toucht_velocity = Vector2.ZERO
var t_velocity = 0 var t_velocity = 0
@export var fireball_prefab : PackedScene
func _unhandled_input(event): func _unhandled_input(event):
if event is InputEventScreenTouch or event is InputEventScreenDrag: if event is InputEventScreenTouch or event is InputEventScreenDrag:
if event.is_pressed(): if event.is_pressed():
if event.position.x < get_viewport_rect().size.x / 2: if event.position.x < get_viewport_rect().size.x / 2:
touch_anchor = event.position touch_anchor = event.position
elif not jump: else:
jump = true if event.position.y > get_viewport_rect().size.y / 2 and not jump:
jump = true
elif not fire:
fire = true
elif event.position.x < get_viewport_rect().size.x / 2: elif event.position.x < get_viewport_rect().size.x / 2:
toucht_velocity = event.position - touch_anchor toucht_velocity = event.position - touch_anchor
if abs(toucht_velocity.x) > 30: if abs(toucht_velocity.x) > 30:
@@ -87,8 +94,19 @@ func _physics_process(delta):
jump = false jump = false
velocity.y = JUMPt_velocity velocity.y = JUMPt_velocity
# check fireball
if is_flower and (Input.is_action_just_pressed("flower") or fire):
fire = false
var instance = fireball_prefab.instantiate()
get_parent().add_child(instance)
instance.position.x = position.x -8 if animated_sprite_2d.flip_h else position.x + 8
instance.position.y = position.y
instance.linear_velocity.x = -400 if animated_sprite_2d.flip_h else 400
instance.linear_velocity.y = 50
instance.angular_velocity = 0
# get input # get input
var direction = Input.get_axis("move_left", "move_right") + t_velocity var direction = Input.get_axis("move_left", "move_right") + t_velocity
if on_pause: if on_pause:
@@ -103,17 +121,23 @@ func _physics_process(delta):
# play animation # play animation
if is_on_floor(): if is_on_floor():
if direction != 0: if direction != 0:
if is_big: if is_flower:
animated_sprite_2d.play("run_flower")
elif is_big:
animated_sprite_2d.play("run_big") animated_sprite_2d.play("run_big")
else: else:
animated_sprite_2d.play("run") animated_sprite_2d.play("run")
else: else:
if is_big: if is_flower:
animated_sprite_2d.play("idle_flower")
elif is_big:
animated_sprite_2d.play("idle_big") animated_sprite_2d.play("idle_big")
else: else:
animated_sprite_2d.play("idle") animated_sprite_2d.play("idle")
else: else:
if is_big: if is_flower:
animated_sprite_2d.play("jump_flower")
elif is_big:
animated_sprite_2d.play("jump_big") animated_sprite_2d.play("jump_big")
else: else:
animated_sprite_2d.play("jump") animated_sprite_2d.play("jump")
@@ -131,11 +155,22 @@ func grow():
collision_shape_2d.shape.height = 32 collision_shape_2d.shape.height = 32
pipedetector_ground.position.y += 8 pipedetector_ground.position.y += 8
func flower():
if not is_big:
collision_shape_2d.shape.height = 32
pipedetector_ground.position.y += 8
is_big = true
is_flower = true
func shrink(): func shrink():
if is_big: if is_flower:
is_flower = false
elif is_big:
is_big = false is_big = false
collision_shape_2d.shape.height = 16 collision_shape_2d.shape.height = 16
pipedetector_ground.position.y -= 8 pipedetector_ground.position.y -= 8
else:
print("dead")
func increase_coins(): func increase_coins():
coins += 1 coins += 1