Made the ultra berry increase your speed for 10 seconds
It stacks just like in normal bd btw. So if you get 2 ultra berries you will have the effect for 20 seconds. Also this was surprisingly easy to add.
This commit is contained in:
1 parent
b0af899416
commit
ace7c8fb03
3 files changed
+29
No files matched your search
@@ -20,6 +20,16 @@ public partial class BerryLogic : Node2D {
|
||||
Globals.HighScore += ScoreAdder;
|
||||
}
|
||||
|
||||
if (BerryType == "ultra") {
|
||||
if (Globals.ActiveEffect == "ultra") {
|
||||
Globals.EffectTimer += 10f;
|
||||
} else {
|
||||
Globals.EffectTimer = 10f;
|
||||
}
|
||||
|
||||
Globals.ActiveEffect = "ultra";
|
||||
}
|
||||
|
||||
QueueFree();
|
||||
}
|
||||
}
|
||||
@@ -7,6 +7,9 @@ public partial class Globals : Node {
|
||||
public static bool VersionChecked = false;
|
||||
|
||||
public static float MovementSpeed = 800f;
|
||||
public static float DefaultMovementSpeed = MovementSpeed;
|
||||
public static string ActiveEffect = "none";
|
||||
public static float EffectTimer = 0f;
|
||||
|
||||
public static int Score = 0;
|
||||
public static int HighScore = 0;
|
||||
|
||||
@@ -28,5 +28,21 @@ public partial class Player : Node2D {
|
||||
}
|
||||
|
||||
Position = Pos;
|
||||
|
||||
// Effect handling
|
||||
if (Globals.ActiveEffect != "none") {
|
||||
Globals.EffectTimer -= (float)delta;
|
||||
}
|
||||
|
||||
if (Globals.EffectTimer < 0f) {
|
||||
Globals.EffectTimer = 0f;
|
||||
Globals.ActiveEffect = "none";
|
||||
}
|
||||
|
||||
if (Globals.ActiveEffect == "none") {
|
||||
Globals.MovementSpeed = Globals.DefaultMovementSpeed;
|
||||
} if (Globals.ActiveEffect == "ultra") {
|
||||
Globals.MovementSpeed = Globals.DefaultMovementSpeed * 2f;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user