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
+165
View File
@@ -0,0 +1,165 @@
[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="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"]
[sub_resource type="AtlasTexture" id="AtlasTexture_7xy4l"]
atlas = ExtResource("1_lffao")
region = Rect2(124, 94, 16, 16)
[sub_resource type="AtlasTexture" id="AtlasTexture_d5dm6"]
atlas = ExtResource("1_lffao")
region = Rect2(154, 94, 16, 16)
[sub_resource type="AtlasTexture" id="AtlasTexture_y8lq8"]
atlas = ExtResource("1_lffao")
region = Rect2(184, 94, 16, 16)
[sub_resource type="AtlasTexture" id="AtlasTexture_8a022"]
atlas = ExtResource("1_lffao")
region = Rect2(214, 94, 16, 16)
[sub_resource type="SpriteFrames" id="SpriteFrames_4nuhx"]
animations = [{
"frames": [{
"duration": 1.0,
"texture": SubResource("AtlasTexture_7xy4l")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_d5dm6")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_y8lq8")
}, {
"duration": 1.0,
"texture": SubResource("AtlasTexture_8a022")
}],
"loop": true,
"name": &"idle",
"speed": 10.0
}]
[sub_resource type="CircleShape2D" id="CircleShape2D_vpcnk"]
radius = 7.0
[sub_resource type="Animation" id="Animation_km6nk"]
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("CollisionShape2D:disabled")
tracks/1/interp = 1
tracks/1/loop_wrap = true
tracks/1/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 1,
"values": [false]
}
tracks/2/type = "value"
tracks/2/imported = false
tracks/2/enabled = false
tracks/2/path = NodePath("PickupSound:playing")
tracks/2/interp = 1
tracks/2/loop_wrap = true
tracks/2/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 1,
"values": [true]
}
[sub_resource type="Animation" id="Animation_ota62"]
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),
"transitions": PackedFloat32Array(1),
"update": 1,
"values": [false]
}
tracks/1/type = "value"
tracks/1/imported = false
tracks/1/enabled = true
tracks/1/path = NodePath("CollisionShape2D:disabled")
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 = "value"
tracks/2/imported = false
tracks/2/enabled = true
tracks/2/path = NodePath("PickupSound:playing")
tracks/2/interp = 1
tracks/2/loop_wrap = true
tracks/2/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 1,
"values": [true]
}
tracks/3/type = "method"
tracks/3/imported = false
tracks/3/enabled = true
tracks/3/path = NodePath(".")
tracks/3/interp = 1
tracks/3/loop_wrap = true
tracks/3/keys = {
"times": PackedFloat32Array(1),
"transitions": PackedFloat32Array(1),
"values": [{
"args": [],
"method": &"queue_free"
}]
}
[sub_resource type="AnimationLibrary" id="AnimationLibrary_whr3u"]
_data = {
"RESET": SubResource("Animation_km6nk"),
"pickup": SubResource("Animation_ota62")
}
[node name="Coin" type="Area2D"]
collision_mask = 2
script = ExtResource("1_shvw0")
[node name="AnimatedSprite2D" type="AnimatedSprite2D" parent="."]
position = Vector2(8, -8)
sprite_frames = SubResource("SpriteFrames_4nuhx")
animation = &"idle"
autoplay = "idle"
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
position = Vector2(8, -8)
shape = SubResource("CircleShape2D_vpcnk")
[node name="PickupSound" type="AudioStreamPlayer2D" parent="."]
stream = ExtResource("3_ioelm")
[node name="AnimationPlayer" type="AnimationPlayer" parent="."]
libraries = {
"": SubResource("AnimationLibrary_whr3u")
}
[connection signal="body_entered" from="." to="." method="_on_body_entered"]
+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"]
+140
View File
@@ -0,0 +1,140 @@
[gd_scene load_steps=11 format=3 uid="uid://b4dp88urmm7g8"]
[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="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"]
[sub_resource type="AtlasTexture" id="AtlasTexture_i8bax"]
atlas = ExtResource("1_tsecc")
region = Rect2(184, 34, 16, 16)
[sub_resource type="SpriteFrames" id="SpriteFrames_s232e"]
animations = [{
"frames": [{
"duration": 1.0,
"texture": SubResource("AtlasTexture_i8bax")
}],
"loop": true,
"name": &"default",
"speed": 5.0
}]
[sub_resource type="CircleShape2D" id="CircleShape2D_ubrn0"]
radius = 8.0
[sub_resource type="CircleShape2D" id="CircleShape2D_drsli"]
radius = 9.0
[sub_resource type="Animation" id="Animation_2r0ts"]
length = 0.001
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath("pickupSound:playing")
tracks/0/interp = 1
tracks/0/loop_wrap = true
tracks/0/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 1,
"values": [false]
}
tracks/1/type = "value"
tracks/1/imported = false
tracks/1/enabled = true
tracks/1/path = NodePath("AnimatedSprite2D:visible")
tracks/1/interp = 1
tracks/1/loop_wrap = true
tracks/1/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 1,
"values": [true]
}
[sub_resource type="Animation" id="Animation_fqoi0"]
resource_name = "pickup"
tracks/0/type = "value"
tracks/0/imported = false
tracks/0/enabled = true
tracks/0/path = NodePath("pickupSound:playing")
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("AnimatedSprite2D:visible")
tracks/1/interp = 1
tracks/1/loop_wrap = true
tracks/1/keys = {
"times": PackedFloat32Array(0),
"transitions": PackedFloat32Array(1),
"update": 1,
"values": [false]
}
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_gubc7"]
_data = {
"RESET": SubResource("Animation_2r0ts"),
"pickup": SubResource("Animation_fqoi0")
}
[node name="mushroom" type="RigidBody2D"]
collision_layer = 8
lock_rotation = true
script = ExtResource("1_qo5bm")
[node name="AnimatedSprite2D" type="AnimatedSprite2D" parent="."]
position = Vector2(8, -8)
sprite_frames = SubResource("SpriteFrames_s232e")
autoplay = "default"
[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
position = Vector2(8, -8)
shape = SubResource("CircleShape2D_ubrn0")
[node name="RayCastLeft" type="RayCast2D" parent="."]
position = Vector2(8, -8)
target_position = Vector2(-9, 0)
[node name="RayCastRight" type="RayCast2D" parent="."]
position = Vector2(8, -8)
target_position = Vector2(9, 0)
[node name="Area2D" type="Area2D" parent="."]
collision_layer = 8
collision_mask = 2
[node name="CollisionShape2D" type="CollisionShape2D" parent="Area2D"]
position = Vector2(8, -8)
shape = SubResource("CircleShape2D_drsli")
[node name="AnimationPlayer" type="AnimationPlayer" parent="."]
libraries = {
"": SubResource("AnimationLibrary_gubc7")
}
[node name="pickupSound" type="AudioStreamPlayer2D" parent="."]
stream = ExtResource("3_ad473")
[connection signal="body_entered" from="Area2D" to="." method="_on_area_2d_body_entered"]