diff --git a/Scripts/BerryLogic.cs b/Scripts/BerryLogic.cs index 6bb1bd3..75f0559 100644 --- a/Scripts/BerryLogic.cs +++ b/Scripts/BerryLogic.cs @@ -2,10 +2,22 @@ using Godot; using System; public partial class BerryLogic : Node2D { + string BerryType = ""; + private void _on_hitbox_area_entered(Area2D area) { - Globals.Score += 1; + Texture2D Sprite = GetNode("Sprite").Texture; + + string BerryTexturesFolder = "res://Textures/Berries/"; + if (Sprite == GD.Load(BerryTexturesFolder + "Berry.png")) { + BerryType = "normal"; + } else if (Sprite == GD.Load(BerryTexturesFolder + "UltraBerry.png")) { + BerryType = "ultra"; + } + + int ScoreAdder = (BerryType == "normal") ? 1 : 5; + Globals.Score += ScoreAdder; if (Globals.Score > Globals.HighScore) { - Globals.HighScore += 1; + Globals.HighScore += ScoreAdder; } QueueFree();