Need a experienced Java dev opinion ! :O
Im making a game in 2D and im having some problems ... first of all I need to have quiet big maps ... and my maps are made of "tile" objects with size of 40x40 pixels ... In each "map" there is an
tile array, witch objects i modify when i make the array ... The main character is supposed to be centered at all times ... Iv thought about 3 ways of doing this :
1. put all objects in a JScrollPane and center the main character.
2. Only paint enoght objects to fill the screen then change the properties of the objects as the character walks traversing trough the array...
3. In some way paint the objects that are supposed to show outside of the Panel (with double buffering) and then change put the image in the panel ... (is it possible to paint only some pixels of an object?)
Is there any better way to store the map data?(will be given by a server)
What way/s would be the best to achive what im trying to do?
Also Iv written methods inside of all objects that checks if the mouse is near and if they where clicked ... but to check this I have to loop though all objects ... is there a better way to do this with hashmap? how would I set the key to a intervall where the object is ?
Thanks ... and please only comment if you think you have a valid solution to one or more of my problems =P