Added Bullet Angle Variance
This commit is contained in:
parent
d0edc20cad
commit
091b1e6327
@ -1,5 +1,7 @@
|
||||
package de.samdev.cannonshooter.entities;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import com.badlogic.gdx.Gdx;
|
||||
import com.badlogic.gdx.Input.Keys;
|
||||
|
||||
@ -17,6 +19,8 @@ public class Cannon extends Entity {
|
||||
private static final float START_HEALTH_REGEN = 0.000015f;
|
||||
private static final float END_HEALTH_REGEN = 0.000105f;
|
||||
|
||||
public final Random Random = new Random();
|
||||
|
||||
public Team team;
|
||||
|
||||
private CannonBarrel barrel;
|
||||
|
@ -20,6 +20,7 @@ public class CannonBarrel extends Entity {
|
||||
private static final float RECOIL_PERC = 0.035f;
|
||||
private static final int MAX_BOOSTER_COUNT = 8;
|
||||
private static final float BOOST_PERCENTAGE = 0.5f;
|
||||
private static final float BULLET_ANGLE_VARIANCE = 6f;
|
||||
|
||||
private boolean dragging = false;
|
||||
|
||||
@ -83,7 +84,8 @@ public class CannonBarrel extends Entity {
|
||||
if (charge > 1) {
|
||||
charge = 0;
|
||||
|
||||
bullet.shoot(rotation);
|
||||
float shootingAngle = rotation + cannon.Random.nextFloat() * BULLET_ANGLE_VARIANCE - (BULLET_ANGLE_VARIANCE/2f);
|
||||
bullet.shoot(shootingAngle);
|
||||
bullet = null;
|
||||
loaded = false;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user