Advertisement

[java] I have problems with creating engine.

Started by January 15, 2000 05:12 AM
0 comments, last by Arch@on 24 years, 11 months ago
I''m creating engine on standalone, but I have found some problems in drawing images. I probably need some sort of component because drawing on the window is so freaking limited(I suppose with my experience) Any good suggestions? (It''s tile based scrolling engine and personal charachter is in the middle of it) Also, should i draw the whole map at time or just the point of view position and then load map all the time? I suppose first one is faster once it has loaded.
Have you taken a look at my "GameFrame for Java" library? You can find it from:
http://www.gamedev.net/hosted/javanerd/
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.
-Pasi Keranen

This topic is closed to new replies.

Advertisement