diff --git a/RPG Test gd4.csproj b/RPG Test gd4.csproj index d9f86c8..4d69f6c 100644 --- a/RPG Test gd4.csproj +++ b/RPG Test gd4.csproj @@ -1,4 +1,4 @@ - + net6.0 true diff --git a/RPG Test gd4.csproj.old.1 b/RPG Test gd4.csproj.old.1 new file mode 100644 index 0000000..d9f86c8 --- /dev/null +++ b/RPG Test gd4.csproj.old.1 @@ -0,0 +1,10 @@ + + + net6.0 + true + RPGTestgd4 + + + + + \ No newline at end of file diff --git a/assets/audios/sound_explode.wav b/assets/audios/sound_explode.wav new file mode 100644 index 0000000..229c853 Binary files /dev/null and b/assets/audios/sound_explode.wav differ diff --git a/assets/audios/sound_explode.wav.import b/assets/audios/sound_explode.wav.import new file mode 100644 index 0000000..24e26c6 --- /dev/null +++ b/assets/audios/sound_explode.wav.import @@ -0,0 +1,24 @@ +[remap] + +importer="wav" +type="AudioStreamWAV" +uid="uid://s64cl4x57oae" +path="res://.godot/imported/sound_explode.wav-e098f161dda656140202efc764be6ab7.sample" + +[deps] + +source_file="res://assets/audios/sound_explode.wav" +dest_files=["res://.godot/imported/sound_explode.wav-e098f161dda656140202efc764be6ab7.sample"] + +[params] + +force/8_bit=false +force/mono=false +force/max_rate=false +force/max_rate_hz=44100 +edit/trim=false +edit/normalize=false +edit/loop_mode=0 +edit/loop_begin=0 +edit/loop_end=-1 +compress/mode=0 diff --git a/assets/font/urbane-rounded-medium.otf b/assets/fonts/urbane-rounded-medium.otf similarity index 100% rename from assets/font/urbane-rounded-medium.otf rename to assets/fonts/urbane-rounded-medium.otf diff --git a/assets/font/urbane-rounded-medium.otf.import b/assets/fonts/urbane-rounded-medium.otf.import similarity index 63% rename from assets/font/urbane-rounded-medium.otf.import rename to assets/fonts/urbane-rounded-medium.otf.import index 1f5e3c7..6724a09 100644 --- a/assets/font/urbane-rounded-medium.otf.import +++ b/assets/fonts/urbane-rounded-medium.otf.import @@ -3,12 +3,12 @@ importer="font_data_dynamic" type="FontFile" uid="uid://cx6bvqk0ghmjv" -path="res://.godot/imported/urbane-rounded-medium.otf-b9893bdfac064b3a1273ef625926190e.fontdata" +path="res://.godot/imported/urbane-rounded-medium.otf-9f9f3b12be0c06a6d7111a1305925d9c.fontdata" [deps] -source_file="res://assets/font/urbane-rounded-medium.otf" -dest_files=["res://.godot/imported/urbane-rounded-medium.otf-b9893bdfac064b3a1273ef625926190e.fontdata"] +source_file="res://assets/fonts/urbane-rounded-medium.otf" +dest_files=["res://.godot/imported/urbane-rounded-medium.otf-9f9f3b12be0c06a6d7111a1305925d9c.fontdata"] [params] diff --git a/project.godot b/project.godot index f827c1a..b79a85e 100644 --- a/project.godot +++ b/project.godot @@ -33,6 +33,7 @@ project/assembly_name="RPG Test gd4" [editor] node_naming/name_casing=2 +export/convert_text_resources_to_binary=true [filesystem] diff --git a/scenes/gui/dialog_bubble.tscn b/scenes/gui/dialog_bubble.tscn index 1721d74..5b06601 100644 --- a/scenes/gui/dialog_bubble.tscn +++ b/scenes/gui/dialog_bubble.tscn @@ -1,7 +1,7 @@ -[gd_scene load_steps=3 format=3 uid="uid://d6ngurhq1r5y"] +[gd_scene load_steps=3 format=3 uid="uid://dcb1x11exmlab"] [ext_resource type="Script" path="res://src/scene-scripts/gui/dialog_bubble.cs" id="1_txwv4"] -[ext_resource type="FontFile" uid="uid://cx6bvqk0ghmjv" path="res://assets/font/urbane-rounded-medium.otf" id="1_vlvkg"] +[ext_resource type="FontFile" uid="uid://cx6bvqk0ghmjv" path="res://assets/fonts/urbane-rounded-medium.otf" id="2_qrihj"] [node name="dialog_bubble" type="CanvasLayer"] script = ExtResource("1_txwv4") @@ -33,7 +33,7 @@ offset_bottom = -9.80798 grow_horizontal = 2 grow_vertical = 0 theme_override_colors/font_color = Color(0, 0, 0, 1) -theme_override_fonts/font = ExtResource("1_vlvkg") +theme_override_fonts/font = ExtResource("2_qrihj") theme_override_font_sizes/font_size = 32 text = "This is test text" autowrap_mode = 3 @@ -49,6 +49,6 @@ offset_top = 4.35199 offset_right = 7.27698 offset_bottom = 4.888 theme_override_colors/font_color = Color(0, 0, 0, 1) -theme_override_fonts/font = ExtResource("1_vlvkg") +theme_override_fonts/font = ExtResource("2_qrihj") theme_override_font_sizes/font_size = 16 text = "Name" diff --git a/scenes/main.tscn b/scenes/main.tscn index dea557a..c75e78a 100644 --- a/scenes/main.tscn +++ b/scenes/main.tscn @@ -1,8 +1,7 @@ -[gd_scene load_steps=4 format=3 uid="uid://2867aayx0skw"] +[gd_scene load_steps=3 format=3 uid="uid://2867aayx0skw"] [ext_resource type="PackedScene" uid="uid://ujfhvssvbgpg" path="res://scenes/player.tscn" id="1_p5d84"] [ext_resource type="PackedScene" uid="uid://cld0jncmsk1bj" path="res://scenes/worlds/first_world.tscn" id="2_x8nyb"] -[ext_resource type="PackedScene" uid="uid://d6ngurhq1r5y" path="res://scenes/gui/dialog_bubble.tscn" id="3_ohogx"] [node name="main" type="Node2D"] @@ -10,6 +9,3 @@ [node name="player" parent="." instance=ExtResource("1_p5d84")] playerName = "PlayerName" - -[node name="dialog_bubble" parent="." instance=ExtResource("3_ohogx")] -visible = false diff --git a/scenes/player.tscn b/scenes/player.tscn index 33973f2..f605755 100644 --- a/scenes/player.tscn +++ b/scenes/player.tscn @@ -1,7 +1,8 @@ -[gd_scene load_steps=13 format=3 uid="uid://ujfhvssvbgpg"] +[gd_scene load_steps=14 format=3 uid="uid://ujfhvssvbgpg"] [ext_resource type="Script" path="res://src/scene-scripts/player.cs" id="1_qehox"] [ext_resource type="Texture2D" uid="uid://olceowuycu8c" path="res://assets/textures/debug/dummy-player-atlas.png" id="2_yu1q5"] +[ext_resource type="PackedScene" uid="uid://d6ngurhq1r5y" path="res://scenes/gui/dialog_bubble.tscn" id="3_8f573"] [sub_resource type="AtlasTexture" id="AtlasTexture_tokqm"] atlas = ExtResource("2_yu1q5") @@ -37,25 +38,55 @@ region = Rect2(168, 128, 84, 128) [sub_resource type="SpriteFrames" id="SpriteFrames_2x1cy"] animations = [{ -"frames": [SubResource("AtlasTexture_tokqm"), SubResource("AtlasTexture_qomfj"), SubResource("AtlasTexture_tokqm"), SubResource("AtlasTexture_bsfbd")], +"frames": [{ +"duration": 1.0, +"texture": SubResource("AtlasTexture_tokqm") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_qomfj") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_tokqm") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_bsfbd") +}], "loop": true, "name": &"move_down", "speed": 5.0 }, { -"frames": [SubResource("AtlasTexture_ulejc"), SubResource("AtlasTexture_1x805")], +"frames": [{ +"duration": 1.0, +"texture": SubResource("AtlasTexture_ulejc") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_1x805") +}], "loop": true, "name": &"move_side", -"speed": 5.0 +"speed": 4.0 }, { -"frames": [SubResource("AtlasTexture_x338k"), SubResource("AtlasTexture_6ynw8"), SubResource("AtlasTexture_x338k"), SubResource("AtlasTexture_2yirn")], +"frames": [{ +"duration": 1.0, +"texture": SubResource("AtlasTexture_x338k") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_6ynw8") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_x338k") +}, { +"duration": 1.0, +"texture": SubResource("AtlasTexture_2yirn") +}], "loop": true, "name": &"move_up", "speed": 5.0 }] [sub_resource type="CapsuleShape2D" id="CapsuleShape2D_38v5o"] -radius = 18.057 -height = 43.9998 +radius = 5.99732 +height = 45.968 [node name="player" type="CharacterBody2D"] process_mode = 1 @@ -71,13 +102,12 @@ collide_with_areas = true [node name="animated_sprite_2d" type="AnimatedSprite2D" parent="."] texture_filter = 1 -position = Vector2(-0.0625, -17.0625) scale = Vector2(0.733398, 0.733398) frames = SubResource("SpriteFrames_2x1cy") animation = &"move_down" [node name="collision_shape" type="CollisionShape2D" parent="."] -position = Vector2(0, 12) +position = Vector2(3.72529e-09, 39) rotation = 1.57345 shape = SubResource("CapsuleShape2D_38v5o") @@ -97,3 +127,6 @@ editor_draw_drag_margin = true [node name="audio_listener_2d" type="AudioListener2D" parent="."] current = true + +[node name="dialog_bubble" parent="." instance=ExtResource("3_8f573")] +visible = false diff --git a/scenes/tiles/sound_debug_tile.tscn b/scenes/tiles/sound_debug_tile.tscn new file mode 100644 index 0000000..cb9b990 --- /dev/null +++ b/scenes/tiles/sound_debug_tile.tscn @@ -0,0 +1,27 @@ +[gd_scene load_steps=5 format=3] + +[ext_resource type="Script" path="res://src/scene-scripts/tiles/audioplayer_tile.cs" id="1_6sf4e"] +[ext_resource type="Texture2D" uid="uid://ciidukjv5k6oa" path="res://assets/textures/debug/banana.png" id="1_7651j"] +[ext_resource type="AudioStream" uid="uid://s64cl4x57oae" path="res://assets/audios/sound_explode.wav" id="3_dnu2u"] + +[sub_resource type="CircleShape2D" id="CircleShape2D_2d5dy"] +radius = 30.8058 + +[node name="first_debug_tile" type="StaticBody2D"] +script = ExtResource("1_6sf4e") +soundOn = false + +[node name="Sprite2D" type="Sprite2D" parent="."] +texture = ExtResource("1_7651j") + +[node name="CollisionShape2D" type="CollisionShape2D" parent="."] +position = Vector2(-1, 4) +shape = SubResource("CircleShape2D_2d5dy") + +[node name="audio_stream_player_2d" type="AudioStreamPlayer2D" parent="."] +stream = ExtResource("3_dnu2u") +autoplay = true +max_distance = 1500.0 +attenuation = 2.0 + +[connection signal="finished" from="audio_stream_player_2d" to="." method="OnAudioFinished"] diff --git a/scenes/worlds/first_world.tscn b/scenes/worlds/first_world.tscn index 6023498..56faee6 100644 --- a/scenes/worlds/first_world.tscn +++ b/scenes/worlds/first_world.tscn @@ -16,4 +16,4 @@ tile_set = ExtResource("2_kvjhj") cell_quadrant_size = 64 format = 2 layer_0/z_index = 1 -layer_0/tile_data = PackedInt32Array(1, 0, 0, 65533, 0, 0, -3, 0, 0, -65535, 0, 0, 65529, 1, 65536, 65541, 1, 65536, -196605, 1, 65536, 196603, 1, 65536, -196603, 1, 65536, -196600, 1, 65536) +layer_0/tile_data = PackedInt32Array(1, 0, 0, 65533, 0, 0, -3, 0, 0, -65535, 0, 0, 65529, 1, 65536, 65541, 1, 65536, -196605, 1, 65536, 196603, 1, 65536, -196603, 1, 65536, -196600, 1, 65536, -131086, 2, 65536) diff --git a/src/scene-scripts/dialog_trigger_area.cs b/src/scene-scripts/dialog_trigger_area.cs index d2c3b4a..e950e9b 100644 --- a/src/scene-scripts/dialog_trigger_area.cs +++ b/src/scene-scripts/dialog_trigger_area.cs @@ -3,10 +3,10 @@ using System; public partial class dialog_trigger_area : Area2D { - [Export(PropertyHint.File, "*json")] - string dialogFile; + [Signal] public delegate void InteractDialogueEventHandler(); + [Export(PropertyHint.File, "*json")] string dialogFile; public void OnInteraction(string playerName) { - GetNode("/root/main/dialog_bubble").Call("ImportString",dialogFile,playerName);//signal instead of call? + } } diff --git a/src/scene-scripts/tiles/audioplayer_tile.cs b/src/scene-scripts/tiles/audioplayer_tile.cs new file mode 100644 index 0000000..57e4e09 --- /dev/null +++ b/src/scene-scripts/tiles/audioplayer_tile.cs @@ -0,0 +1,11 @@ +using Godot; + +public partial class audioplayer_tile : StaticBody2D +{ + [Export] bool soundOn = true; + public void OnAudioFinished() + { + if (soundOn) GetNode("audio_stream_player_2d").Play(); + } + +} diff --git a/tilesets/main_foreground.tres b/tilesets/main_foreground.tres index a184e0a..24f656c 100644 --- a/tilesets/main_foreground.tres +++ b/tilesets/main_foreground.tres @@ -1,7 +1,8 @@ -[gd_resource type="TileSet" load_steps=5 format=3 uid="uid://txl24cadn8t4"] +[gd_resource type="TileSet" load_steps=7 format=3 uid="uid://txl24cadn8t4"] [ext_resource type="PackedScene" uid="uid://dk7fqaw2b3w1k" path="res://scenes/tiles/first_debug_tile.tscn" id="1_uxmn6"] [ext_resource type="PackedScene" uid="uid://dckxciecwjfgf" path="res://scenes/tiles/dialogdebug_cupcake.tscn" id="2_0cov5"] +[ext_resource type="PackedScene" path="res://scenes/tiles/sound_debug_tile.tscn" id="3_lf2fs"] [sub_resource type="TileSetScenesCollectionSource" id="TileSetScenesCollectionSource_lcrun"] resource_name = "test" @@ -11,7 +12,12 @@ scenes/0/scene = ExtResource("1_uxmn6") resource_name = "dialogdebug" scenes/1/scene = ExtResource("2_0cov5") +[sub_resource type="TileSetScenesCollectionSource" id="TileSetScenesCollectionSource_xtxu0"] +resource_name = "sounddebug" +scenes/1/scene = ExtResource("3_lf2fs") + [resource] tile_size = Vector2i(64, 64) sources/0 = SubResource("TileSetScenesCollectionSource_lcrun") sources/1 = SubResource("TileSetScenesCollectionSource_eskkr") +sources/2 = SubResource("TileSetScenesCollectionSource_xtxu0")