Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 Creating Boundaries using Colours?
Index -> Programming, Java -> Java Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
sh0td0wn




PostPosted: 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
Sponsor
sponsor
Tony




PostPosted: 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.
Latest from compsci.ca/blog: Tony's programming blog. DWITE - a programming contest.
sh0td0wn




PostPosted: 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




PostPosted: Thu Dec 18, 2008 2:28 pm   Post subject: RE:Creating Boundaries using Colours?

whatdotcolor (x inside object, y inside object)
HellblazerX




PostPosted: 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.
Display posts from previous:   
   Index -> Programming, Java -> Java Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 5 Posts ]
Jump to:   


Style:  
Search: