the cannon jearth rotates faster with increasing boost

This commit is contained in:
Mike Schwörer 2015-09-21 19:09:37 +02:00
parent 091b1e6327
commit 173ef66168
3 changed files with 11 additions and 7 deletions

View File

@ -141,4 +141,8 @@ public class Cannon extends Entity {
health = 1;
}
}
public float getBoost() {
return barrel.getBoost();
}
}

View File

@ -77,8 +77,7 @@ public class CannonBarrel extends Entity {
private void updateCharge(float delta) {
if (cannon.health == 0 || cannon.health == 1) {
if (loaded)
{
if (loaded) {
charge += CHARGE_SPEED * getBoost() * delta * cannon.team.speedMultiplier;
if (charge > 1) {

View File

@ -14,6 +14,7 @@ import de.samdev.cannonshooter.ZLayers;
public class CannonHearth extends Entity {
private static final Color COLOR_HEARTLESS = new Color(0.75f, 0.75f, 0.75f, 1f);
private static final float ROTATION_SPEED = 0.125f;
private static final float ROTATION_MODULO = 90;
private float rotation = 0;
@ -45,17 +46,17 @@ public class CannonHearth extends Entity {
public void beforeUpdate(float delta) {
if (cannon.health < 1) {
if (rotation != 0 && cannon.health > 0) {
rotation = (rotation - delta * ROTATION_SPEED * cannon.team.speedMultiplier);
rotation = (rotation - delta * ROTATION_SPEED * cannon.team.speedMultiplier * cannon.getBoost());
if (rotation < 0) rotation = 0;
}
if (cannon.health == 0){
rotation = (rotation - delta * ROTATION_SPEED * cannon.team.speedMultiplier);
if (rotation < 0) rotation += 45;
rotation = (rotation - delta * ROTATION_SPEED * cannon.team.speedMultiplier * cannon.getBoost());
if (rotation < 0) rotation += ROTATION_MODULO;
}
} else {
rotation = (rotation - delta * ROTATION_SPEED * cannon.team.speedMultiplier);
if (rotation < 0) rotation += 45;
rotation = (rotation - delta * ROTATION_SPEED * cannon.team.speedMultiplier * cannon.getBoost());
if (rotation < 0) rotation += ROTATION_MODULO;
}
}