Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: Best way to achieve a 'map'?  (Read 1370 times)

0 Members and 1 Guest are viewing this topic.

zombiekiller222

  • Guest
Best way to achieve a 'map'?
« on: September 01, 2011, 07:13:47 am »
I have a 'terrain generator' which generates a top down image that looks like a map. It creates an image with pixels of different colors. These colors correspond to either a texture or an object. My program, to display this image, textures 'texture pixels' and adds objects (groups of pixels like a tree or a rock) where the 'object pixels' are using:

Code: [Select]
map.copy(object, pixelx, pixely)

The method described above is pretty slow. People have suggested to me to use an array instead of an image for the 'data'. How would I go about using an array for this purpose? How could I do operations such as copying?

The texture part is also very slow. I use getPixel and setPixel. How do I texture a region of pixels based on color quickly?

And most importantly, how could I make this process faster?

Thank you.

 

anything