Hey everyone, I've been using lwjgl in order to make a zombie tower defense game on here. The lwjgl is not the problem, but instead the mechanics of the towers shooting. I have the shooting with the function:
public void shoot(int damage, int time, float speed, int width, int height, Texture bullet, Zombies... zom)
Java Code:
	{
		int delta = getDelta();
		Zombies t = choose(zom);
		waittime += delta / 16;
		for(int i = 0; i < zom.length; i++)
		{
			if(zom[i] == null)
			{
				continue;
			}
			if(zom[i].equals(t))
			{
				if(zom[i].inRange(this))
					{
						aim(zom[i]);
					}
				if(zom[i] != null && canShoot && 
						Point2D.distance(t.x, t.y + t.randomy, bulletx, bullety) > 1)
				{
					float disty = t.y - finaly + t.randomy - 10 + t.movingNumY(speed);
					float distx = (float) (t.x - finalx - 10) + t.movingNumX(speed);
					System.out.println(t.x + " " + t.y);
					bulletx += distx/speed;
					bullety += disty/speed;
					drawBullet(width, height, bullet);
				}
				if(waittime % time == 0 && zom[i].inRange(this) && canShoot == false)
				{
					canShoot = true;
				}
				if((Point2D.distance(t.x, t.y + t.randomy, bulletx, bullety) <= 1) 
						|| (bulletx<0 || bullety<0 || bulletx > 800 || bullety > 600))
				{
					bulletx = finalx + 10;
					bullety = finaly + 10;
					zom[i].health -= damage;
					canShoot = false;
				}
				System.out.println(Point2D.distance(t.x, t.y + t.randomy, bulletx, bullety));
				if(zom[i].dead())
				{
					SpawnManager.moneyamount += 20;
					chosezombie = false;
					zom[i]=null;
				}
			}
		}
	}
The problem here are the moving numbers with the zombies. The zombies movie horizontally, with x++ right, and x-- for left, and then when the going around the corners, they go x+= .35 and x-=.35, and y++. The move numbers are two predict the zombies while moving to account for the fact its not shooting at an immobile target. These functions are:

public float movingNumX(float speed)
Java Code:
	{
		if(x > 624)
		{
			if((y <= 160 && y >= 106))
			{
				numx = -0.7f;
			}
			else if(y < 106)
			{
				numx = 0.7f;
			}
		}
		else if(x <  144 && y >= 160)
		{
			if((y < 212 && y >= 160) || (y < 392 && y <= 338) || (y < 454 && y >= 392))
			{
				numx = -0.35f;
			}
			else if((y < 278 && y >= 212) || (y < 338 && y <= 278) || (y < 516 && y >= 454))
			{
				numx = 0.35f;
			}
		}
		else if(x <= 624 || (y > 106 && x > 144))
		{
			if(y == 44 || y == 278 || y == 516)
			{
				numx = 1f;
			}
			else if(y == 160 || y == 392)
			{
				numx = -1f;
			}
		}
		System.out.println(numx);
		return (speed/2) * numx;
	}
and:

Java Code:
public float movingNumY(float speed)
	{
		if(x >= 624)
		{
			numy = 1f;
		}
		else if(x <= 144 && y > 106)
		{
			numy = 1f;
		}
		else
		{
			numy = 0;
		}
		System.out.println(numy);
		return (speed) * numy;
	}
For some reason it will miss them, usually by about 5 or 6 pixels, but sometimes even by 10 or 12. I don't need it to be exact, but I know there has to be a way to make it under 2. I understand if you can't help, it's very confusing, and I suck at explaining.

Thanks though,
PFolder