Im making a doodle-jump style game in java and I have having trouble figuring out how to “move up” in the java container that the game is being played in. The doodle guy has to jump from ledge to ledge and get as high as possible, so I need the panel to pan up as the guy moves up. How would I go about doing this?
Share
In a few words: you need an offscreen image. Paint your picture to the offscreen image, copy it to the screen, draw the guy on top of it. Now scroll the contents of the offscreen image a little, fill in the blank spot with a newly-revealed area, copy to the screen, draw the guy.
If you were clever, you could do this without actually moving anything in the offscreen image — you could just change the point to which you copy the image, and fill in the blank area with new data from the part of the offscreen image that has “scrolled off the screen”, if that makes any sense. That’s a little trickier, but will perform better.