Page 1 of 1

getpixel()

PostPosted: Thu Mar 03, 2005 3:02 am
by trajecto
I would love to see getpixel() added to Drawing Functions!

The GetPixel function retrieves the red, green, blue (RGB) color value of the pixel at the specified coordinates.

PostPosted: Thu Mar 03, 2005 9:12 pm
by willg101
I like that idea :!:

PostPosted: Fri Mar 04, 2005 1:11 am
by jazz_e_bob
If you can put you should be allowed to get! ;-)

What is your application for this function by the way?

Image processing perhaps?

PostPosted: Fri Mar 04, 2005 1:55 am
by trajecto
I have written something in Turbo Pascal which has GetPixel(). I had microbes hunting around for food particles. They could "see" them by looking around at surrounding pixels with GetPixel().

PostPosted: Fri Mar 04, 2005 2:19 am
by jazz_e_bob
Brilliant. I love AI stuff.

PostPosted: Mon Jan 15, 2007 10:49 pm
by JonGoten
I NEED this function to my next game.

I thought it was, but now I can´t see it :shock:

Dammm I´ve started the game already.

PostPosted: Tue Jan 16, 2007 11:31 am
by Fuzzy
What about referencing an array that stores the contents of any location?


If you dont have a lot of critters or food on screen, it will be easier to make an array that points to each actor. perhaps not real pointers, but each actor could store his x and y there when it moves. If you use the actors old x and y, then you simulate synchronous movement, where no critter gets an advantage by moving first. in this case, use two arrays.

1. look in the old content array and decide what to do; move, eat, whatever.
2. move
3. store your actor.x and y in the current array
4. go to the next actor starting at step 1
4. after all the critters have moved, you copy the current array into the old array.

If you have a whole screen of critters, it may be simpler to use two arrays for every location on screen.