I did this a while ago to make a map that determined what spots have better resources in a turn based strategy game. I'm gonig to give you a little example and see if you can figure it out (so you get a better grasp of the evil pixel functions while you're at it)
Just load in a grayscale map, and then do something like the following:
Since ReadPixel returns an annoying Bit colour for the read data, use this function to get the right R,G,B values.
If you are using a grayscale map, you could just make this read the red value and return it.
Now, you divide this new number (which should be out of 255) by 255. So something like: Value = B2Cr / 255
This will return a number that can be used as a percentage. This number can then help to determine whatever percentage you need to find out in order to do something, so for your image map, you would have it read through every pixel (possibly with a step value of 5 or something) and then
I hope this helped.
Just load in a grayscale map, and then do something like the following:
Since ReadPixel returns an annoying Bit colour for the read data, use this function to get the right R,G,B values.
Function BitToComponent(ARGB) B2Cr=ARGB Shr 16 And $FF B2Cg=ARGB Shr 8 And $FF B2Cb=ARGB And $FF End Function
If you are using a grayscale map, you could just make this read the red value and return it.
Now, you divide this new number (which should be out of 255) by 255. So something like: Value = B2Cr / 255
This will return a number that can be used as a percentage. This number can then help to determine whatever percentage you need to find out in order to do something, so for your image map, you would have it read through every pixel (possibly with a step value of 5 or something) and then
If Value > 0.5 ;if colour is bigger than 50 percent white ;Random number for if object placement allowed ;(I would assume this could be useful to stop ;from getting huge masses of objects ;Object placement goes here if random number ;is the right one, with Coordinate X being pixel X and ;Coordinate Z being pixel Y ;If you are using a terrain, Y is terrainHeight ;at those coordinates. endIf
I hope this helped.