ok, having a little translation brain freeze.
Have a 2000 by 2000 space sector(playing field).
Player will start at center of this. sectorWidth/2 sectorHeight/2
Player ship needs to be centered on glass (800 * 600 fullscreen mode)
Space Station image is at sector based 100 by 100.
When player moves, station should remain at sector coordinates 100 by 100, but move closer to me
as the screen translates…
I thought I had this working, but relized that my 100 by 100 station is actually on glass 100 by 100
any thoughts?
M
below is the code snippet that centers my ship and allows rotation and tracks the actual sector x and y properly. the drawString shows actualX and actualY at 1000,1000 and adjusts properly based on the direction the ship is going:
// adjust ships actual sector x and y GOOD
x += Math.sin(facing) * speed;
y -= Math.cos(facing) * speed;
int actualX = Math.round(x); // gives actual sector x
int actualY = Math.round(y); // gives actual sector y
AffineTransform at = new AffineTransform();
at.translate(400,300);
at.rotate(facing,ship[speed].getWidth(null)>>1,ship[speed].getHeight(null)>>1);
g.setTransform(at);
g.drawImage(ship[speed], 0, 0, null);
g.drawString(" " + actualX + " : " + actualY, 0,0);