From bee846c3ba05e94e8eef9920a886606894eaa84a Mon Sep 17 00:00:00 2001 From: Thepuppetqueen57 Date: Thu, 28 Aug 2025 23:22:15 -0700 Subject: [PATCH] Added berries --- Prefabs/Berries/Berry.tscn | 22 ++++++++++++++++ Scenes/Game.tscn | 17 ++++++++++++- Scripts/Berries.cs | 29 +++++++++++++++++++++ Scripts/Berries.cs.uid | 1 + Scripts/BerryLogic.cs | 8 ++++++ Scripts/BerryLogic.cs.uid | 1 + Textures/Berries/Berry.png | Bin 0 -> 2114 bytes Textures/Berries/Berry.png.import | 34 +++++++++++++++++++++++++ Textures/Berries/UltraBerry.png | Bin 0 -> 2091 bytes Textures/Berries/UltraBerry.png.import | 34 +++++++++++++++++++++++++ 10 files changed, 145 insertions(+), 1 deletion(-) create mode 100644 Prefabs/Berries/Berry.tscn create mode 100644 Scripts/Berries.cs create mode 100644 Scripts/Berries.cs.uid create mode 100644 Scripts/BerryLogic.cs create mode 100644 Scripts/BerryLogic.cs.uid create mode 100644 Textures/Berries/Berry.png create mode 100644 Textures/Berries/Berry.png.import create mode 100644 Textures/Berries/UltraBerry.png create mode 100644 Textures/Berries/UltraBerry.png.import diff --git a/Prefabs/Berries/Berry.tscn b/Prefabs/Berries/Berry.tscn new file mode 100644 index 0000000..1930f3c --- /dev/null +++ b/Prefabs/Berries/Berry.tscn @@ -0,0 +1,22 @@ +[gd_scene load_steps=4 format=3 uid="uid://cuxasb6eg47gw"] + +[ext_resource type="Script" uid="uid://byjsgr18ieauy" path="res://Scripts/BerryLogic.cs" id="1_0wwwo"] +[ext_resource type="Texture2D" uid="uid://keupgfuijdl7" path="res://Textures/Berries/Berry.png" id="1_g0wxr"] + +[sub_resource type="RectangleShape2D" id="RectangleShape2D_7lihs"] +size = Vector2(183, 203) + +[node name="Berry" type="Node2D"] +script = ExtResource("1_0wwwo") + +[node name="Sprite" type="Sprite2D" parent="."] +scale = Vector2(1.52344, 1.52344) +texture = ExtResource("1_g0wxr") + +[node name="Hitbox" type="Area2D" parent="."] + +[node name="Shape" type="CollisionShape2D" parent="Hitbox"] +shape = SubResource("RectangleShape2D_7lihs") +debug_color = Color(0.713726, 0, 0.321569, 0.156863) + +[connection signal="area_entered" from="Hitbox" to="." method="_on_hitbox_area_entered"] diff --git a/Scenes/Game.tscn b/Scenes/Game.tscn index 0e007c2..7767490 100644 --- a/Scenes/Game.tscn +++ b/Scenes/Game.tscn @@ -1,13 +1,21 @@ -[gd_scene load_steps=3 format=3 uid="uid://bgt46l5p8qrwc"] +[gd_scene load_steps=5 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"] +[ext_resource type="Script" uid="uid://bdwdadvx0axam" path="res://Scripts/Berries.cs" id="1_kldst"] + +[sub_resource type="CircleShape2D" id="CircleShape2D_j5yw3"] +radius = 117.004 [node name="Game" type="Node2D"] [node name="Center" type="Node2D" parent="."] position = Vector2(960, 540) +[node name="Berries" type="Node2D" parent="."] +position = Vector2(960, 0) +script = ExtResource("1_kldst") + [node name="Player" type="Node2D" parent="."] position = Vector2(960, 978) script = ExtResource("1_gl6un") @@ -15,3 +23,10 @@ script = ExtResource("1_gl6un") [node name="Texture" type="Sprite2D" parent="Player"] scale = Vector2(1.675, 1.675) texture = ExtResource("1_iukft") + +[node name="Hitbox" type="Area2D" parent="Player"] +position = Vector2(-5, 23) + +[node name="CollisionShape2D" type="CollisionShape2D" parent="Player/Hitbox"] +shape = SubResource("CircleShape2D_j5yw3") +debug_color = Color(1, 1, 1, 0.188235) diff --git a/Scripts/Berries.cs b/Scripts/Berries.cs new file mode 100644 index 0000000..38b6931 --- /dev/null +++ b/Scripts/Berries.cs @@ -0,0 +1,29 @@ +using Godot; +using System; + +public partial class Berries : Node2D { + private float SpawnBerryTimer = 0f; + + public override void _Process(double delta) { + Vector2 Pos = Position; + Pos.Y += 500f * (float)delta; + + SpawnBerryTimer += (float)delta; + + int ScreenWidth = DisplayServer.WindowGetSize().X; + + if (SpawnBerryTimer > 1.0) { + SpawnBerryTimer = 0f; + + PackedScene Berry = GD.Load("res://Prefabs/Berries/Berry.tscn"); + + Node2D BerryInstance = Berry.Instantiate(); + + BerryInstance.Position = new Vector2(x: new Random().Next(-(ScreenWidth / 2), ScreenWidth / 2), y: -100 - Position.Y); + + AddChild(BerryInstance); + } + + Position = Pos; + } +} diff --git a/Scripts/Berries.cs.uid b/Scripts/Berries.cs.uid new file mode 100644 index 0000000..ad11ef6 --- /dev/null +++ b/Scripts/Berries.cs.uid @@ -0,0 +1 @@ +uid://bdwdadvx0axam diff --git a/Scripts/BerryLogic.cs b/Scripts/BerryLogic.cs new file mode 100644 index 0000000..6b80004 --- /dev/null +++ b/Scripts/BerryLogic.cs @@ -0,0 +1,8 @@ +using Godot; +using System; + +public partial class BerryLogic : Node2D { + private void _on_hitbox_area_entered(Area2D area) { + QueueFree(); + } +} diff --git a/Scripts/BerryLogic.cs.uid b/Scripts/BerryLogic.cs.uid new file mode 100644 index 0000000..e7d0fc6 --- /dev/null +++ b/Scripts/BerryLogic.cs.uid @@ -0,0 +1 @@ +uid://byjsgr18ieauy diff --git a/Textures/Berries/Berry.png b/Textures/Berries/Berry.png new file mode 100644 index 0000000000000000000000000000000000000000..0530437c279066c4c78525b15082ce7ca916d409 GIT binary patch literal 2114 zcmV-I2)*}-P)C00001b5ch_0Itp) z=>Px#1ZP1_K>z@;j|==^1poj58&FJCMF0Q*EmQ$GYXU=m0=EEC&H!Ac07{VnK>z>% zcXR;?00009bW%=J|NsC0|NsC008>wR5&!@I32;bRa{vGizW@LZzX3P}QzQTY2b)Pm zK~#8N?U;*h6*&+@0|^WN|HWHXU4FM`=FS}!t;CTacDvnm;+qAuAHV)Ee+B;M0w3@D zzbo*z!8-#GUj(!qY+N~=|As(K@Pha#D{XjLpbo{CZ{NOQt;%=elc;=tMoE=Dr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cQ1=stRfs5Qg-yq23P(rmK4 zRm1Oxw*_SOwUDRCs_s^xQi^~B5))btmxv77pu%pdRj~?3In)wjNgMx`b%H)RdWz6* zwtzfBX$7%8$Q=1WiA2dpnf;4~d)I=B?Fn~eg4&p|GJp)RyfRWdNe?$4r?9k-Am*q( z)SR@4$2i(p{p=2*CA<8)oeWl#L~`X2|7_z-eO+9_M+lSYIef5%E4A3FjK za|_9_Em7{*pKQe=ug!;P+bf=IdZ>$I?f1S=@G&nF*T@>E;^oS8V6;JxY2EpuY--*$ z!hMj`J89$^Db0$_pc{<|LqRKZHXEqzS(-c@a)0YmM~QFY@&^do==TAGo#K~DU2HUpq}_- z&HcvDsvHJ8u`OUQ*!Z-Lca;tU#FCBN7r%>=Z_ORLk&jqE611A7(2NQ=Ipxt=WaM2r z&K6k?llDc!fQO`TLG==u4zJzRZVYMnXU{{dxohK>LL literal 0 HcmV?d00001 diff --git a/Textures/Berries/UltraBerry.png.import b/Textures/Berries/UltraBerry.png.import new file mode 100644 index 0000000..9dc5174 --- /dev/null +++ b/Textures/Berries/UltraBerry.png.import @@ -0,0 +1,34 @@ +[remap] + +importer="texture" +type="CompressedTexture2D" +uid="uid://7fwiqc21hiyt" +path="res://.godot/imported/UltraBerry.png-529cb931871380681f93b86879fe758b.ctex" +metadata={ +"vram_texture": false +} + +[deps] + +source_file="res://Textures/Berries/UltraBerry.png" +dest_files=["res://.godot/imported/UltraBerry.png-529cb931871380681f93b86879fe758b.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