From 3b0f47492d326c669b6407076c92f44bfb2ed38b Mon Sep 17 00:00:00 2001 From: Thepuppetqueen57 Date: Tue, 26 Aug 2025 14:48:17 -0700 Subject: [PATCH] Added the game scene There are no berries yet and the bird floats if the screen size isnt 1920 by 1080 but I am still making good progress --- Berry Dash Godot Remake.csproj | 7 +++++++ Berry Dash Godot Remake.sln | 19 ++++++++++++++++++ Scenes/Game.tscn | 17 ++++++++++++++++ Scenes/MainMenu.tscn | 5 ++++- Scripts/Player.cs | 29 +++++++++++++++++++++++++++ Scripts/Player.cs.uid | 1 + Scripts/SceneSwitcher.cs | 23 +++++++++++++++++++++ Scripts/SceneSwitcher.cs.uid | 1 + Textures/Icons/Bird1.png | Bin 0 -> 1363 bytes Textures/Icons/Bird1.png.import | 34 ++++++++++++++++++++++++++++++++ project.godot | 2 +- 11 files changed, 136 insertions(+), 2 deletions(-) create mode 100644 Berry Dash Godot Remake.csproj create mode 100644 Berry Dash Godot Remake.sln create mode 100644 Scenes/Game.tscn create mode 100644 Scripts/Player.cs create mode 100644 Scripts/Player.cs.uid create mode 100644 Scripts/SceneSwitcher.cs create mode 100644 Scripts/SceneSwitcher.cs.uid create mode 100644 Textures/Icons/Bird1.png create mode 100644 Textures/Icons/Bird1.png.import diff --git a/Berry Dash Godot Remake.csproj b/Berry Dash Godot Remake.csproj new file mode 100644 index 0000000..4692ecd --- /dev/null +++ b/Berry Dash Godot Remake.csproj @@ -0,0 +1,7 @@ + + + net8.0 + true + BerryDashGodotRemake + + \ No newline at end of file diff --git a/Berry Dash Godot Remake.sln b/Berry Dash Godot Remake.sln new file mode 100644 index 0000000..08b1a10 --- /dev/null +++ b/Berry Dash Godot Remake.sln @@ -0,0 +1,19 @@ +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 2012 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Berry Dash Godot Remake", "Berry Dash Godot Remake.csproj", "{52B1C37F-037D-494E-BAF1-252292499806}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + ExportDebug|Any CPU = ExportDebug|Any CPU + ExportRelease|Any CPU = ExportRelease|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {52B1C37F-037D-494E-BAF1-252292499806}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {52B1C37F-037D-494E-BAF1-252292499806}.Debug|Any CPU.Build.0 = Debug|Any CPU + {52B1C37F-037D-494E-BAF1-252292499806}.ExportDebug|Any CPU.ActiveCfg = ExportDebug|Any CPU + {52B1C37F-037D-494E-BAF1-252292499806}.ExportDebug|Any CPU.Build.0 = ExportDebug|Any CPU + {52B1C37F-037D-494E-BAF1-252292499806}.ExportRelease|Any CPU.ActiveCfg = ExportRelease|Any CPU + {52B1C37F-037D-494E-BAF1-252292499806}.ExportRelease|Any CPU.Build.0 = ExportRelease|Any CPU + EndGlobalSection +EndGlobal diff --git a/Scenes/Game.tscn b/Scenes/Game.tscn new file mode 100644 index 0000000..0e007c2 --- /dev/null +++ b/Scenes/Game.tscn @@ -0,0 +1,17 @@ +[gd_scene load_steps=3 format=3 uid="uid://bgt46l5p8qrwc"] + +[ext_resource type="Script" uid="uid://dfv3cmvcskd6t" path="res://Scripts/Player.cs" id="1_gl6un"] +[ext_resource type="Texture2D" uid="uid://5ecdlqnn0u6g" path="res://Textures/Icons/Bird1.png" id="1_iukft"] + +[node name="Game" type="Node2D"] + +[node name="Center" type="Node2D" parent="."] +position = Vector2(960, 540) + +[node name="Player" type="Node2D" parent="."] +position = Vector2(960, 978) +script = ExtResource("1_gl6un") + +[node name="Texture" type="Sprite2D" parent="Player"] +scale = Vector2(1.675, 1.675) +texture = ExtResource("1_iukft") diff --git a/Scenes/MainMenu.tscn b/Scenes/MainMenu.tscn index fa084ff..40e17d3 100644 --- a/Scenes/MainMenu.tscn +++ b/Scenes/MainMenu.tscn @@ -1,6 +1,7 @@ -[gd_scene load_steps=7 format=3 uid="uid://bg4fa11htun38"] +[gd_scene load_steps=8 format=3 uid="uid://bg4fa11htun38"] [ext_resource type="FontFile" uid="uid://dq7nkk7n7wrq4" path="res://Fonts/Lexend.ttf" id="1_tt5f1"] +[ext_resource type="Script" uid="uid://bc4miccifwrk0" path="res://Scripts/SceneSwitcher.cs" id="2_8saeu"] [ext_resource type="AudioStream" uid="uid://6v4630hrkeg6" path="res://Audio/Music/Menu.mp3" id="2_853f1"] [sub_resource type="LabelSettings" id="LabelSettings_tt5f1"] @@ -137,6 +138,8 @@ theme_override_styles/hover = SubResource("StyleBoxFlat_853f1") theme_override_styles/pressed = SubResource("StyleBoxFlat_8saeu") theme_override_styles/normal = SubResource("StyleBoxFlat_tt5f1") text = "Play" +script = ExtResource("2_8saeu") +ScenePath = "res://Scenes/Game.tscn" [node name="AudioStreamPlayer" type="AudioStreamPlayer" parent="."] stream = ExtResource("2_853f1") diff --git a/Scripts/Player.cs b/Scripts/Player.cs new file mode 100644 index 0000000..3275804 --- /dev/null +++ b/Scripts/Player.cs @@ -0,0 +1,29 @@ +using Godot; +using System; + +public partial class Player : Node2D { + private float MovementSpeed = 800f; + + public override void _Ready() { + Position = new Vector2(x: DisplayServer.WindowGetSize().X / 2, y: 0); + } + + public override void _Process(double delta) { + var ScreenSize = GetViewport().GetVisibleRect().Size; + var WindowSize = DisplayServer.WindowGetSize(); + var Scale = WindowSize / ScreenSize; + + Vector2 Pos = Position; + Pos.Y = (DisplayServer.WindowGetSize().Y - 90) / Scale.Y; + + if (Input.IsKeyPressed((Key)Key.Left) || Input.IsKeyPressed((Key)Key.A)) { + Pos.X -= MovementSpeed * (float)delta; + } + + if (Input.IsKeyPressed((Key)Key.Right) || Input.IsKeyPressed((Key)Key.D)) { + Pos.X += MovementSpeed * (float)delta; + } + + Position = Pos; + } +} diff --git a/Scripts/Player.cs.uid b/Scripts/Player.cs.uid new file mode 100644 index 0000000..0f25d96 --- /dev/null +++ b/Scripts/Player.cs.uid @@ -0,0 +1 @@ +uid://dfv3cmvcskd6t diff --git a/Scripts/SceneSwitcher.cs b/Scripts/SceneSwitcher.cs new file mode 100644 index 0000000..ec65b32 --- /dev/null +++ b/Scripts/SceneSwitcher.cs @@ -0,0 +1,23 @@ +using Godot; + +public partial class SceneSwitcher : Button { + [Export] + public string ScenePath = ""; // Set this in the Inspector + + public override void _Ready() { + Pressed += OnButtonPressed; + } + + private void OnButtonPressed() { + if (string.IsNullOrEmpty(ScenePath)) { + GD.PrintErr("Scene path not set!"); + return; + } + + var error = GetTree().ChangeSceneToFile(ScenePath); + + if (error != Error.Ok) { + GD.PrintErr("Failed to change scene: " + error); + } + } +} \ No newline at end of file diff --git a/Scripts/SceneSwitcher.cs.uid b/Scripts/SceneSwitcher.cs.uid new file mode 100644 index 0000000..d019ef3 --- /dev/null +++ b/Scripts/SceneSwitcher.cs.uid @@ -0,0 +1 @@ +uid://bc4miccifwrk0 diff --git a/Textures/Icons/Bird1.png b/Textures/Icons/Bird1.png new file mode 100644 index 0000000000000000000000000000000000000000..3564832892ca9ff6b46f7e59230a1ad7eba4adee GIT binary patch literal 1363 zcmeAS@N?(olHy`uVBq!ia0vp^4Is?H3?#oinD`S&F%}28J29*~C-V}>VM%xNb!1@J z*w6hZkrl`n4e$wZ1=9b4;D+SW{S5zaFuZ^N9w?HlHxZ?_U#$SD z*_ImNnda%K#lQjNurf$7vNA9NSzbUa4P}FTpuxxt7H0yo4H=mj1b}oD5NEctfW@nsj=usGrW+?+uY63e03s9wjk+A{e0*I*~8(9}XOqv2@g8&oITqdx}AWI7% z3#!Y|zyKtBCQq!!EBJ*B0|WCpPZ!6KinzB^PL?e;5OD2${N;ark$g*5)v8HcO$B1R zX5V<>%VvFhKmX>3t;-{suQiw^@J66fRm^5={&_0rru|wed?@9%eZHee&)>^xEE^-@ z94_jztlau(wLxj4{HoVqS+3k|nBU2q!T2ig!1*I}vl@0u7Z`u#T_8SR?!z193;qv; znZNKVqqwBP!4{W9}{ zf2nL|q7Tfx@bA~Zx-y0<`|leh+`2Bn{^qUwe)EJwOfnnZzJ2e{cVpXGS%d7x->P@A z_8UL=#(MGm23ZI0ym<>ApJ|f4Y#(vK`ZXh;=KV&-JqxlAU1nSx)wCgAcY@fy51X5p zC);Q)P1qZ|K;!P2I#%W6n#|6lpO|&-Z)85j;=}WCs;by(?Hh434HTjTd?$!*W-k#F z$&;yA~ze@(>4YJaXD%b9H~$J<4B zKNeCw_S%tIPu9za5)5GjM;j4crnZb&cyJHs+=yDL?zP*7#Kh zXKk3iQi*5H#2fEka2;1%eQUj=jlv$*v&)N2S%q%IE!&c?cF`%7HNJVbuW~MaKjo3e z!7x^-b;)vJtzHYRFih*7lD7Fk$qRE{tLIu*bhvX`E3YRk(sPo(7jGa@kjiNF^Z6-m zpT@e&3rqVRF#ct|>GOqmVqN3|+m;lKTgP57zLHNb=AN`LLpqrEZA(1Qf$rE72f445 zJElJkIyl8a#>he0=`9yyFw;|mqb(d$HIG#pNw80Oy*QoCLimY`i{XQl7p(sLV`pc1 z;&RhO&E8V|)H1{RWQMqslPf;Sx1Y2&T2;)Y3<3H({`0r zj<(I^>dqkM|}ywV;;^0%wS&*!HZyWY}r) zX1Tqj%~VabfG1A3_8gW>$YPyRxxwUZ0o#l)##A|-v(d8{cU?|M)m!8PVr`nVe{QJ% z`VSTdMLK&$HIlKM+d7EZEddmLR4 zvvNPwm~G(R9J3)rW+|V?^4JYB6<$y6#ltKzB|ZF?iJr6k$LtcP(z<*5uT7v_?&<31 Jvd$@?2>{`u4iW$W literal 0 HcmV?d00001 diff --git a/Textures/Icons/Bird1.png.import b/Textures/Icons/Bird1.png.import new file mode 100644 index 0000000..10a7cb6 --- /dev/null +++ b/Textures/Icons/Bird1.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://5ecdlqnn0u6g" +path="res://.godot/imported/Bird1.png-ea98819da12161c623b9d14119eadbcf.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://Textures/Icons/Bird1.png" +dest_files=["res://.godot/imported/Bird1.png-ea98819da12161c623b9d14119eadbcf.ctex"] + +[params] + +compress/mode=0 +compress/high_quality=false +compress/lossy_quality=0.7 +compress/hdr_compression=1 +compress/normal_map=0 +compress/channel_pack=0 +mipmaps/generate=false +mipmaps/limit=-1 +roughness/mode=0 +roughness/src_normal="" +process/fix_alpha_border=true +process/premult_alpha=false +process/normal_map_invert_y=false +process/hdr_as_srgb=false +process/hdr_clamp_exposure=false +process/size_limit=0 +detect_3d/compress_to=1 diff --git a/project.godot b/project.godot index 99db368..9bed386 100644 --- a/project.godot +++ b/project.godot @@ -12,7 +12,7 @@ config_version=5 config/name="Berry Dash Godot Remake" run/main_scene="uid://bg4fa11htun38" -config/features=PackedStringArray("4.4", "Mobile") +config/features=PackedStringArray("4.4", "C#", "Mobile") config/icon="res://icon.svg" [display]