I am in need of a more efficient code to make my bullets spawn a certain distance from my tower but still in the correct direction
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | public void addBullet() { List<unit> ammotoward = getObjectsInRange(maxRange, unit. class ); if (ammotoward.size() != 0 && reload >= 0 ) { LazerAmmo bullet = new LazerAmmo(); getWorld().addObject(bullet, getX(),getY()); bullet.setRotation(getRotation()); reload -=reloadtimer; } if (reload < 0 ) { reload += 1 ; } } |