the cannon jearth rotates faster with increasing boost
This commit is contained in:
parent
091b1e6327
commit
173ef66168
@ -141,4 +141,8 @@ public class Cannon extends Entity {
|
|||||||
health = 1;
|
health = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public float getBoost() {
|
||||||
|
return barrel.getBoost();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -77,8 +77,7 @@ public class CannonBarrel extends Entity {
|
|||||||
|
|
||||||
private void updateCharge(float delta) {
|
private void updateCharge(float delta) {
|
||||||
if (cannon.health == 0 || cannon.health == 1) {
|
if (cannon.health == 0 || cannon.health == 1) {
|
||||||
if (loaded)
|
if (loaded) {
|
||||||
{
|
|
||||||
charge += CHARGE_SPEED * getBoost() * delta * cannon.team.speedMultiplier;
|
charge += CHARGE_SPEED * getBoost() * delta * cannon.team.speedMultiplier;
|
||||||
|
|
||||||
if (charge > 1) {
|
if (charge > 1) {
|
||||||
|
@ -14,6 +14,7 @@ import de.samdev.cannonshooter.ZLayers;
|
|||||||
public class CannonHearth extends Entity {
|
public class CannonHearth extends Entity {
|
||||||
private static final Color COLOR_HEARTLESS = new Color(0.75f, 0.75f, 0.75f, 1f);
|
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_SPEED = 0.125f;
|
||||||
|
private static final float ROTATION_MODULO = 90;
|
||||||
|
|
||||||
private float rotation = 0;
|
private float rotation = 0;
|
||||||
|
|
||||||
@ -45,17 +46,17 @@ public class CannonHearth extends Entity {
|
|||||||
public void beforeUpdate(float delta) {
|
public void beforeUpdate(float delta) {
|
||||||
if (cannon.health < 1) {
|
if (cannon.health < 1) {
|
||||||
if (rotation != 0 && cannon.health > 0) {
|
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 (rotation < 0) rotation = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cannon.health == 0){
|
if (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 += 45;
|
if (rotation < 0) rotation += ROTATION_MODULO;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
rotation = (rotation - delta * ROTATION_SPEED * cannon.team.speedMultiplier);
|
rotation = (rotation - delta * ROTATION_SPEED * cannon.team.speedMultiplier * cannon.getBoost());
|
||||||
if (rotation < 0) rotation += 45;
|
if (rotation < 0) rotation += ROTATION_MODULO;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user