Added the speedy berry
yes ik I have only added stuff from the original bd so far but at some point I do I want to add some original stuff
This commit is contained in:
1 parent
e42d348986
commit
4593f4f122
9 files changed
+92
-6
No files matched your search
+6
-4
@@ -8,7 +8,7 @@ public partial class Berries : Node2D {
|
||||
Vector2 Pos = Position;
|
||||
|
||||
if (!Globals.IsPaused) {
|
||||
Pos.Y += 500f * (float)delta;
|
||||
Pos.Y += Globals.BerrySpeed * (float)delta;
|
||||
|
||||
SpawnBerryTimer += (float)delta;
|
||||
}
|
||||
@@ -30,12 +30,14 @@ public partial class Berries : Node2D {
|
||||
|
||||
if (BerryChance <= 60) {
|
||||
BerrySprite.Texture = (Texture2D)GD.Load("res://Textures/Berries/Berry.png");
|
||||
} else if (BerryChance <= 80) {
|
||||
} else if (BerryChance <= 75) {
|
||||
BerrySprite.Texture = (Texture2D)GD.Load("res://Textures/Berries/PoisonBerry.png");
|
||||
} else if (BerryChance <= 90) {
|
||||
} else if (BerryChance <= 85) {
|
||||
BerrySprite.Texture = (Texture2D)GD.Load("res://Textures/Berries/SlowBerry.png");
|
||||
} else {
|
||||
} else if (BerryChance <= 95) {
|
||||
BerrySprite.Texture = (Texture2D)GD.Load("res://Textures/Berries/UltraBerry.png");
|
||||
} else {
|
||||
BerrySprite.Texture = (Texture2D)GD.Load("res://Textures/Berries/SpeedyBerry.png");
|
||||
}
|
||||
|
||||
AddChild(BerryInstance);
|
||||
|
||||
+16
-1
@@ -16,10 +16,13 @@ public partial class BerryLogic : Node2D {
|
||||
BerryType = "poison";
|
||||
} else if (Sprite == GD.Load(BerryTexturesFolder + "SlowBerry.png")) {
|
||||
BerryType = "slow";
|
||||
} else if (Sprite == GD.Load(BerryTexturesFolder + "SpeedyBerry.png")) {
|
||||
BerryType = "speedy";
|
||||
}
|
||||
|
||||
int ScoreAdder = (BerryType == "normal") ? 1 :
|
||||
(BerryType == "poison" || BerryType == "slow") ? 0 : 5;
|
||||
(BerryType == "poison" || BerryType == "slow") ? 0 :
|
||||
(BerryType == "speedy") ? 10 : 0;
|
||||
|
||||
Globals.Score += ScoreAdder;
|
||||
if (Globals.Score > Globals.HighScore) {
|
||||
@@ -64,6 +67,18 @@ public partial class BerryLogic : Node2D {
|
||||
BerrySoundPlayer.Stream = (AudioStream)GD.Load("res://Audio/SFX/Powerup.mp3");
|
||||
BerrySoundPlayer.VolumeDb = Globals.SoundEffectVolume * 0.005f;
|
||||
BerrySoundPlayer.Play();
|
||||
} else if (BerryType == "speedy") {
|
||||
if (Globals.ActiveEffect == "speedy") {
|
||||
Globals.EffectTimer += 10f;
|
||||
} else {
|
||||
Globals.EffectTimer = 10f;
|
||||
}
|
||||
|
||||
Globals.ActiveEffect = "speedy";
|
||||
|
||||
BerrySoundPlayer.Stream = (AudioStream)GD.Load("res://Audio/SFX/SpeedyPowerup.mp3");
|
||||
BerrySoundPlayer.VolumeDb = Globals.SoundEffectVolume * 0.005f;
|
||||
BerrySoundPlayer.Play();
|
||||
}
|
||||
|
||||
QueueFree();
|
||||
|
||||
+3
-1
@@ -8,10 +8,12 @@ public partial class Globals : Node {
|
||||
|
||||
public static float MovementSpeed = 800f;
|
||||
public static float DefaultMovementSpeed = MovementSpeed;
|
||||
public static float BerrySpeed = 500f;
|
||||
public static float DefaultBerrySpeed = BerrySpeed;
|
||||
public static float JumpHeight = -1100f;
|
||||
public static float DefaultJumpHeight = JumpHeight;
|
||||
public static float Gravity = 3000f;
|
||||
public static float DefaultGravity = JumpHeight;
|
||||
public static float DefaultGravity = Gravity;
|
||||
|
||||
public static string ActiveEffect = "none";
|
||||
public static float EffectTimer = 0f;
|
||||
|
||||
@@ -63,10 +63,16 @@ public partial class Player : Node2D {
|
||||
|
||||
if (Globals.ActiveEffect == "none") {
|
||||
Globals.MovementSpeed = Globals.DefaultMovementSpeed;
|
||||
Globals.BerrySpeed = Globals.DefaultBerrySpeed;
|
||||
} else if (Globals.ActiveEffect == "ultra") {
|
||||
Globals.MovementSpeed = Globals.DefaultMovementSpeed * 2f;
|
||||
Globals.BerrySpeed = Globals.DefaultBerrySpeed;
|
||||
} else if (Globals.ActiveEffect == "slow") {
|
||||
Globals.MovementSpeed = Globals.DefaultMovementSpeed / 2f;
|
||||
Globals.BerrySpeed = Globals.DefaultBerrySpeed;
|
||||
} else if (Globals.ActiveEffect == "speedy") {
|
||||
Globals.MovementSpeed = Globals.DefaultMovementSpeed * 2f;
|
||||
Globals.BerrySpeed = Globals.DefaultBerrySpeed * 2f;
|
||||
}
|
||||
|
||||
if (Input.IsActionJustPressed("EscapeKey") && !Globals.IsPaused) {
|
||||
|
||||
@@ -18,6 +18,8 @@ public partial class ScoreText : Control {
|
||||
EffectTimerType = "Boost";
|
||||
} else if (Globals.ActiveEffect == "slow") {
|
||||
EffectTimerType = "Slowness";
|
||||
} else if (Globals.ActiveEffect == "speedy") {
|
||||
EffectTimerType = "Speed";
|
||||
}
|
||||
EffectTimerText.Text = EffectTimerType + " " + "expires in: " + Math.Floor(Globals.EffectTimer * 10) / 10 + "s";
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user