diff --git a/scenes/destroyblock.tscn b/scenes/destroyblock.tscn index dc333a0..229055c 100644 --- a/scenes/destroyblock.tscn +++ b/scenes/destroyblock.tscn @@ -1,7 +1,8 @@ -[gd_scene load_steps=7 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="Script" path="res://scripts/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"] [sub_resource type="AtlasTexture" id="AtlasTexture_nbg0j"] atlas = ExtResource("1_4h0ce") @@ -24,17 +25,145 @@ size = Vector2(16, 16) [sub_resource type="RectangleShape2D" id="RectangleShape2D_r8vfl"] size = Vector2(8, 1) +[sub_resource type="Animation" id="Animation_hu2np"] +resource_name = "destroy" +tracks/0/type = "value" +tracks/0/imported = false +tracks/0/enabled = true +tracks/0/path = NodePath("CollisionShape2D:disabled") +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("destroySound: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" +}] +} +tracks/3/type = "value" +tracks/3/imported = false +tracks/3/enabled = true +tracks/3/path = NodePath("AnimatedSprite2D:visible") +tracks/3/interp = 1 +tracks/3/loop_wrap = true +tracks/3/keys = { +"times": PackedFloat32Array(0), +"transitions": PackedFloat32Array(1), +"update": 1, +"values": [false] +} + +[sub_resource type="Animation" id="Animation_la8ht"] +length = 0.001 +tracks/0/type = "value" +tracks/0/imported = false +tracks/0/enabled = true +tracks/0/path = NodePath("CollisionShape2D:disabled") +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("destroySound: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 = "value" +tracks/2/imported = false +tracks/2/enabled = true +tracks/2/path = NodePath("AnimatedSprite2D:visible") +tracks/2/interp = 1 +tracks/2/loop_wrap = true +tracks/2/keys = { +"times": PackedFloat32Array(0), +"transitions": PackedFloat32Array(1), +"update": 1, +"values": [false] +} + +[sub_resource type="Animation" id="Animation_4lptd"] +resource_name = "idle" +tracks/0/type = "value" +tracks/0/imported = false +tracks/0/enabled = true +tracks/0/path = NodePath("CollisionShape2D:disabled") +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="AnimationLibrary" id="AnimationLibrary_55ebx"] +_data = { +"RESET": SubResource("Animation_la8ht"), +"destroy": SubResource("Animation_hu2np"), +"idle": SubResource("Animation_4lptd") +} + [node name="destroyblock" type="RigidBody2D"] gravity_scale = 0.0 script = ExtResource("1_a8383") [node name="AnimatedSprite2D" type="AnimatedSprite2D" parent="."] +visible = false position = Vector2(8, -8) sprite_frames = SubResource("SpriteFrames_r70hc") [node name="CollisionShape2D" type="CollisionShape2D" parent="."] position = Vector2(8, -8) shape = SubResource("RectangleShape2D_i07jg") +disabled = true [node name="activate" type="Area2D" parent="."] collision_mask = 2 @@ -43,4 +172,14 @@ collision_mask = 2 position = Vector2(8, 0.5) shape = SubResource("RectangleShape2D_r8vfl") +[node name="destroySound" type="AudioStreamPlayer2D" parent="."] +stream = ExtResource("3_bsm87") +volume_db = 13.0 + +[node name="AnimationPlayer" type="AnimationPlayer" parent="."] +libraries = { +"": SubResource("AnimationLibrary_55ebx") +} +autoplay = "idle" + [connection signal="body_entered" from="activate" to="." method="_on_activate_body_entered"] diff --git a/scenes/gumba.tscn b/scenes/gumba.tscn index 1872007..dac9856 100644 --- a/scenes/gumba.tscn +++ b/scenes/gumba.tscn @@ -2,7 +2,7 @@ [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="AudioStream" uid="uid://vq1g2x6id5jt" path="res://assets/sounds/NES - Super Mario Bros - Sound Effects/Super Mario Bros 1 and 2(JP)/Bump.wav" id="3_7yqeq"] +[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"] atlas = ExtResource("1_fe7l6") @@ -93,7 +93,7 @@ shape = SubResource("RectangleShape2D_oec64") one_shot = true [node name="dieSound" type="AudioStreamPlayer2D" parent="."] -stream = ExtResource("3_7yqeq") +stream = ExtResource("3_v1fjb") [connection signal="timeout" from="Timer" to="." method="_on_timer_timeout"] [connection signal="body_entered" from="die" to="." method="_on_die_body_entered"] diff --git a/scenes/level_1.tscn b/scenes/level_1.tscn index 766aa92..9e27e3f 100644 --- a/scenes/level_1.tscn +++ b/scenes/level_1.tscn @@ -19098,6 +19098,7 @@ hit_object = ExtResource("6_evydd") [node name="itemblock5" parent="interactable_blocks" instance=ExtResource("3_fmbwm")] position = Vector2(1168, -48) +hit_object = ExtResource("6_evydd") [node name="destroyblock4" parent="interactable_blocks" instance=ExtResource("4_4f23w")] position = Vector2(1152, -48) @@ -19140,6 +19141,7 @@ position = Vector2(1408, -112) [node name="itemblock6" parent="interactable_blocks" instance=ExtResource("3_fmbwm")] position = Vector2(1424, -112) +hit_object = ExtResource("6_evydd") [node name="destroyblock17" parent="interactable_blocks" instance=ExtResource("4_4f23w")] position = Vector2(1424, -48) @@ -19152,15 +19154,19 @@ position = Vector2(1536, -48) [node name="itemblock7" parent="interactable_blocks" instance=ExtResource("3_fmbwm")] position = Vector2(1616, -48) +hit_object = ExtResource("6_evydd") [node name="itemblock8" parent="interactable_blocks" instance=ExtResource("3_fmbwm")] position = Vector2(1664, -48) +hit_object = ExtResource("6_evydd") [node name="itemblock9" parent="interactable_blocks" instance=ExtResource("3_fmbwm")] position = Vector2(1712, -48) +hit_object = ExtResource("6_evydd") [node name="itemblock10" parent="interactable_blocks" instance=ExtResource("3_fmbwm")] position = Vector2(1664, -112) +hit_object = ExtResource("7_rk0p2") [node name="destroyblock20" parent="interactable_blocks" instance=ExtResource("4_4f23w")] position = Vector2(1792, -48) @@ -19179,9 +19185,11 @@ position = Vector2(1952, -112) [node name="itemblock11" parent="interactable_blocks" instance=ExtResource("3_fmbwm")] position = Vector2(1968, -112) +hit_object = ExtResource("6_evydd") [node name="itemblock12" parent="interactable_blocks" instance=ExtResource("3_fmbwm")] position = Vector2(1984, -112) +hit_object = ExtResource("6_evydd") [node name="destroyblock25" parent="interactable_blocks" instance=ExtResource("4_4f23w")] position = Vector2(2000, -112) @@ -19200,6 +19208,7 @@ position = Vector2(2704, -48) [node name="itemblock13" parent="interactable_blocks" instance=ExtResource("3_fmbwm")] position = Vector2(2720, -48) +hit_object = ExtResource("6_evydd") [node name="destroyblock30" parent="interactable_blocks" instance=ExtResource("4_4f23w")] position = Vector2(2736, -48) @@ -19305,6 +19314,7 @@ position = Vector2(1120, 0) [node name="Gumba5" parent="." instance=ExtResource("8_be76n")] position = Vector2(1152, 0) -[node name="Music" type="AudioStreamPlayer2D" parent="."] +[node name="Music" type="AudioStreamPlayer" parent="."] stream = ExtResource("9_xkthi") +volume_db = -5.0 autoplay = true diff --git a/scenes/player.tscn b/scenes/player.tscn index 26730c2..4460049 100644 --- a/scenes/player.tscn +++ b/scenes/player.tscn @@ -1,9 +1,11 @@ -[gd_scene load_steps=20 format=3 uid="uid://dk1aby88pygtr"] +[gd_scene load_steps=22 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"] [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="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://bo4big602rvtr" path="res://assets/sounds/NES - Super Mario Bros - Sound Effects/Super Mario Bros 1 and 2(JP)/Jump.wav" id="6_aq3u4"] [sub_resource type="AtlasTexture" id="AtlasTexture_l22ll"] atlas = ExtResource("1_w3chr") @@ -218,6 +220,12 @@ offset_right = 120.0 offset_bottom = 96.0 texture = ExtResource("4_o0q77") +[node name="PipeSound" type="AudioStreamPlayer2D" parent="."] +stream = ExtResource("5_kvw73") + +[node name="JumpSound" type="AudioStreamPlayer2D" parent="."] +stream = ExtResource("6_aq3u4") + [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"] diff --git a/scripts/destroyblock.gd b/scripts/destroyblock.gd index ceff86e..22b7852 100644 --- a/scripts/destroyblock.gd +++ b/scripts/destroyblock.gd @@ -1,10 +1,11 @@ extends RigidBody2D @onready var animated_sprite_2d = $AnimatedSprite2D +@onready var animation_player = $AnimationPlayer func _ready(): animated_sprite_2d.play("default") func _on_activate_body_entered(body): if body.is_big: - queue_free() + animation_player.play("destroy") diff --git a/scripts/player.gd b/scripts/player.gd index abbad5c..aab445a 100644 --- a/scripts/player.gd +++ b/scripts/player.gd @@ -7,6 +7,8 @@ extends CharacterBody2D @onready var coin_amt = $CanvasLayer/Control/CoinAmt @onready var collision_shape_2d = $CollisionShape2D @onready var pipedetector_ground = $pipedetector_ground +@onready var pipe_sound = $PipeSound +@onready var jump_sound = $JumpSound const SPEED = 130.0 @@ -66,6 +68,7 @@ func _process(delta): # check pipe if on_pipe and (Input.is_action_just_pressed("crawl") or crawl) and is_on_floor() or right_pipe and (Input.is_action_pressed("move_right") or t_velocity > 0): + pipe_sound.play() crawl = false t_velocity = 0 color_rect.visible = true @@ -79,7 +82,8 @@ func _physics_process(delta): velocity.y += gravity * delta # Handle jump. - if not on_pause and (Input.is_action_just_pressed("jump") or jump) and is_on_floor(): + if not on_pause and (Input.is_action_pressed("jump") or jump) and is_on_floor(): + jump_sound.play() jump = false velocity.y = JUMPt_velocity @@ -122,9 +126,10 @@ func _physics_process(delta): move_and_slide() func grow(): - is_big = true - collision_shape_2d.shape.height = 32 - pipedetector_ground.position.y += 8 + if not is_big: + is_big = true + collision_shape_2d.shape.height = 32 + pipedetector_ground.position.y += 8 func shrink(): if is_big: @@ -154,6 +159,7 @@ func _on_pipedetector_right_area_exited(area): func _on_pipe_timer_timeout(): on_pause = false color_rect.visible = false + pipe_sound.play() func _on_pipe_timer_half_timeout():