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 0000000..3564832 Binary files /dev/null and b/Textures/Icons/Bird1.png differ 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]