Posted: Thu Dec 18, 2008 1:18 pm Post subject: Creating Boundaries using Colours?
Can someone explain how to create boundaries using colour?
Say if a ball goes to a specified colour (say outside a wall), it won't because it will stop?
I remember in Turing that there is something like that called What.Color for detection.
Sponsor Sponsor
Tony
Posted: Thu Dec 18, 2008 1:46 pm Post subject: RE:Creating Boundaries using Colours?
There was something like that, that would read the colour of a specific pixel on the screen, so that you could "read" a drawn image. An ugly hack is to use your graphics buffer for both drawing your game on screen and storing information about your game's state. Which kind of made sense back in the day when computers had as much accessible memory as a modern calculator.
You check for collision by calculating the distance between two objects.
Posted: Thu Dec 18, 2008 2:01 pm Post subject: Re: Creating Boundaries using Colours?
Another question: How do you find the colour of an object?
Insectoid
Posted: Thu Dec 18, 2008 2:28 pm Post subject: RE:Creating Boundaries using Colours?
whatdotcolor (x inside object, y inside object)
HellblazerX
Posted: Fri Dec 19, 2008 10:41 am Post subject: Re: RE:Creating Boundaries using Colours?
insectoid @ Thu Dec 18, 2008 2:28 pm wrote:
whatdotcolor (x inside object, y inside object)
Wrong section I believe.
The BufferedImage class has the method getRGB (int x, int y), which is pretty much the same as Turing's whatdocolor function, but as Tony said, it's much better to do collision detection by calculating the distances.