added boost charge when eating snacks

This commit is contained in:
2025-10-06 17:31:04 +02:00
parent 84de61388e
commit ec76dd5c85
2 changed files with 7 additions and 3 deletions

View File

@@ -122,6 +122,7 @@ class TurtleGame extends StatelessGame {
this.snacks.remove(snack);
snack.remove();
this.turtlePlayerMap.get(p).increaseScore();
this.turtlePlayerMap.get(p).increaseBoostChargeLevel(0.02f);
}
protected void explode(Player p, Entity bomb) {
@@ -184,7 +185,6 @@ class TurtleGame extends StatelessGame {
meta.setBlock(this.snackBlock.withProperty("half", "upper"));
meta.setCustomName(Component.text("Snack").color(NamedTextColor.WHITE));
meta.setCustomNameVisible(true);
meta.setHasGlowingEffect(true);
snack.setInstance(this);
Pos spawnPosition = this.newSpawnPosition(snack);
if(spawnPosition == null) {

View File

@@ -38,8 +38,7 @@ public class Turtle extends EntityCreature {
public void startBoostRefill() {
this.boostRefillTask = MinecraftServer.getSchedulerManager().scheduleTask(() -> {
if(this.boostChargeLevel >= 1f) return;
this.boostChargeLevel = Math.min(1f, this.boostChargeLevel + 0.025f);
this.player.setExp(this.boostChargeLevel);
this.increaseBoostChargeLevel(0.02f);
}, TaskSchedule.seconds(1), TaskSchedule.seconds(1));
}
@@ -88,6 +87,11 @@ public class Turtle extends EntityCreature {
this.boostSpeedMultiplier = 1;
}
public void increaseBoostChargeLevel(float amount) {
this.boostChargeLevel = Math.min(1f, this.boostChargeLevel + amount);
this.player.setExp(this.boostChargeLevel);
}
public void addSpeed(double amount) {
this.speed += amount;
}