I’m making my ship builder test right now. I’m almost done but have ran into a problem I can’t google because I really don’t know how to word it correctly to get me what I want. I want to be able to click and it adds a new ship part, but I can’t just let it add a new part without having a grid system because then lining up certain parts of a ship would be almost impossible. So, how would I do it? I’m just trying to get it so that when I hit my mouse button instead of having it add the object right at the exact x and y coords of the mouse, but to have it on a 32 x 32 grid without programming some advanced tile based system.
Heres my current code:
int x = input.getMouseX();
int y = input.getMouseY();
//ADDING Ship parts
if(input.isMouseButtonDown(0)) {
sc.addPart(new BasicPart(x, y));
}