Question

I'm making a simple side scroller game in Java but am having trouble making the camera move with the person. My plan was to create a buffered image that could adjust the region of the image that is displaying and simply have it follow my character. However, I couldn't find any functions in the API to change the region of the buffered image that's displayed, so how could I do this? Thanks for any help provided.

 //The level is created in an 800x400 pixel size, is there any way I can change
 //the region myImage displays?
myImage =  new BufferedImage(400, 400, BufferedImage.TYPE_INT_RGB);
Was it helpful?

Solution

Well while you will be drawing your image you have a lot of options for example this function can draw any rectangle from your original image on any rectangle of the surface you get Graphics object from.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top