I seem to remember that I managed to do this before, but maybe I am mistaken.
I have a huge array that I want to fill with values each time the game starts and I thought that I might just be able to read them pixel by pixel from the room background as color codes.
Is this possible, and, if so, how?
I remember bashing my head up against dynamic sprites for hours before finally getting it working.
Something about GetPixel?
You need this:
DrawingSurface* ds = Room.GetDrawingSurfaceForBackground();
int color = ds.GetPixel(x, y);
Thanks so much, Khris!
QuoteI have a huge array that I want to fill with values each time the game starts and I thought that I might just be able to read them pixel by pixel from the room background
If it's not a real room background, but the way for you to have data, you may also read image from a file or a sprite, using DynamicSprite.CreateFromFile/CreateFromExistingSprite. Then get pixels using its drawing surface, as in above example, and delete the image:
DynamicSprite *spr = DynamicSprite.CreateFromFile("myfile,bmp");
// or
DynamicSprite *spr = DynamicSprite.CreateFromExistingSprite(100);
DrawingSurface* ds = spr.GetDrawingSurcace();
int color = ds.GetPixel(x, y);
ds.Release();
spr.Delete();
Thanks, CW! This will also come in handy! I did this a long time ago with my Predators/Prey simulator but forgot how to.