Scrolling in tile based Games

How do you make it so that the player is centered as it walks and moves through a tile map ?I've tried moving every object manually but i cant get it to work, and it also seems very inefficient.Thanks.
[223 byte] By [that_other_guya] at [2007-11-27 7:28:49]
# 1
Graphics2Dtranslate(int x, int y) Translates the origin of the Graphics2D context to the point (x, y) in the current coordinate system.
robtafta at 2007-7-12 19:08:57 > top of Java-index,Other Topics,Java Game Development...
# 2

> How do you make it so that the player is centered as

> it walks and moves through a tile map ?

>

> I've tried moving every object manually but i cant

> get it to work, and it also seems very inefficient.

>

> Thanks.

Or,

To make this quicker make a superbitmap (Image larger than the visible display) equal to the maximum scroll width/height.Then use

drawImage(Image img,int dx1,int dy1,int dx2,int dy2,

int sx1,int sy1,int sx2,int sy2,Color bgcolor,ImageObserver observer)

Then render your tiles in the offscreen portion of the area you

intend to scroll to and then use the sx,sy,sx2sy2 values to offset the

original Image into the target image in 1 blit.

Further, please port the render code you are using; perhaps we can see

some optimizations you may make to avoid major performance hits

I am sure what you want to do can be done in a timely manner.

(T)

tswaina at 2007-7-12 19:08:57 > top of Java-index,Other Topics,Java Game Development...