tylercomp
tylercomp

Reputation: 132

How do I create a camera in java to change perspective?

I have a java applet that draws top left x,y(0,0) to bottom right x,y(500,500). How would I go about having that same applet draw what is located in top left x,y(500,0) to bottom right x,y(1000,500)?

Upvotes: 1

Views: 259

Answers (1)

Patrick
Patrick

Reputation: 17973

You have alot of methods available in the Graphics class called drawImage.

I believe this is the one you are after which is able to draw a particular part of an image at a particular place on a canvas.

Edit: Based on your comment I would suggest that you draw your map to an Image and then use the drawImage method to draw the image from a specified offset. Every time your offset is changed, draw the image from that location instead.

Upvotes: 1

Related Questions