[java] I have problems with creating engine.,
Banned - Reputation: 100
Posted 14 January 2000 - 11:12 PM
Members - Reputation: 122
Posted 16 January 2000 - 09:20 PM
and it provides many things that are needed for 2D game programming.
You shouldn''t draw the whole map at a time, but you should have the 2D array representing the tiles loaded all the time (if you aren''t using HUGE tile maps that take up tens of megabytes of memory) and draw parts of that instead.
You didn''t mention do you want to move the character with jumps from one tile to another or smoothly pixel by pixel.
I''ll take the latter one as an example.
You need an offscreen image that is larger than you display size. You draw the tiles from the map data to that image (using some offsets to the map data) and use the image to draw the map on to the screen. By changing the drawing offset of the image you can smoothly scroll that piece of map on the screen and when the player moves enough pixels to count as one tile you just change the offset to the map data accordingly and redraw the image using tiles and reset the image drawing offsets.