[solved] Lines not rendering correctly Java2D

Hey JGO, I’m having a graphics glitch when trying to render a line from my player to every tile within 5 spaces.

When the tile is to the right of the player the lines render properly.
When the tile is to the left of the player the lines screw up.

Picture:

Thanks for any help :slight_smile:

EDIT:
Here’s my code:
NOTE: Even without my added code (Just a g2d.drawLine call, the glitch still occurs).


		for (Tile t : tiles) {
			// draw tile image
			g2d.drawImage(grassTile01.getImage(), t.getX(), t.getY(), t.getWidth(), t.getHeight(), null);
		
			// player centerX
			int targetX = playerX + 32 / 2;
			
			// player centerY
			int targetY = playerY + 32 / 2;
			
			// If the tile is within 5 spaces to our right.
			// WORKS PERFECTLY
			if (t.getX() >= targetX && t.getX() <= targetX + 32 * 5) {
				
				// if the tile isn't within 5 spaces above us.
				if (!(t.getY() >= playerY - 32 * 5)) {
					
					// don't render a line.
					continue;
				}
				
				// if the tile isn't within 5 spaces below us.
				if (!(t.getY() <= playerY + 32 * 5)) {
					
					// don't render a line.
					continue;
				}

				// if the tile's made it this far, render the line.
				g2d.drawLine(targetX, targetY, t.getX(), t.getY());
				
				// if the tile is to the left (Testing to fix)
				// DOESNT WANT TO WORK 
			} else if (t.getX() <= targetX) {
				
				// if the tile isn't within 5 spaces to our left.
				if (!(t.getX() >= playerX - 32*5)) {
					
					//don't render a line.
					continue;
				}
				
				// if the tile isn't within 5 spaces below us.
				if (!(t.getY() >=playerY-32*5)){
					
					// don't render a line.
					continue;
				}
				
				// if the tile isn't within 5 spaces above us.
				if (!(t.getY() <= playerY+32*5)){
					
					// don't render a line.
					continue;
				}
				
				// if the tile's made it this far, render the line.
				g2d.drawLine(t.getX(), t.getY(),targetX, targetY);
			}
		}

Thanks for any help guys / gals :slight_smile: