Sign in to follow this  
Moen

printing ONE image multiple times on different places

Recommended Posts

hello, i am making a game right now, and got to the point of collision detection for objects on the screen

 

the collision for the borders/end of screen is already done, and the algorythm for moving the screen along the character is done, the way i do this is that i draw the map and when i move, the x and y of the map move, giving the illusion, its a 2d pokemon fr,lg kind of viewing angle game, where the player is alway in the middle fo the screen.

 

so, i used a program called Tiled to make the map, and i though about importing a transparent image, and printing it out where there should be collision (i will have a common variable x and y to move it along with the map, and move the collision) i want to print this ONE image multiple times. i have been trying for a while now, but i dont know how to go forward with this one.

 

i have thought of adding the image to an arraylist and then printing it multiple times, different locations. but how would i go on doing this, plz help, i have been trying to add a image to arraylist, and i have made it, but i dont know how to print it, or how to specify location, or if the common x and y variables can have different values for the images.

i will post the source code when i come home. if you know any other good/ easy way of printing ONE image multiple times different spawn locations, plz tell me, 

 

thnx in advanced ^^

Share this post


Link to post
Share on other sites
Make an array of some custom class that holds a reference to the image as well as the position to draw it at. Usually such a class is called a sprite class.

What does you code look like for drawing a single image? Edited by HappyCoder

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this