Since there has been so much asking for a map editor, I'm going to make one. I just need help with one thing:
How do you calculate the positions in the game? This meaning how do you calculate the mouse position and make the entities rendered orient themselves around the middle of your screen?
I've been trying around for 4 hours. I wanted to keep it secret, but it's inevitable :/
Solved(this is java codes!):
public int findX(float x) {
return (int) (x * mng.camera.zoom - mng.camera.x * mng.camera.zoom + mng.frameObj.getWidth()/2);
}
public int findY(float y) {
return (int) (y * mng.camera.zoom - mng.camera.y * mng.camera.zoom + mng.frameObj.getHeight()/2);
}
public int findXR(float x) {
return (int) ((x-mng.frameObj.getWidth()/2) / mng.camera.zoom + mng.camera.x);
}
public int findYR(float y) {
return (int) ((y-mng.frameObj.getHeight()/2) / mng.camera.zoom + mng.camera.y);
}