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

Username:   Password: 
 RegisterRegister   
 WHATDOTCOLOR!!!!
Index -> Programming, Java -> Java Help
Goto page Previous  1, 2
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
Spartan_117




PostPosted: Thu Jun 02, 2005 7:11 pm   Post subject: (No subject)

Ya, i've pretty much forgot about using whatdotcolour. I've already done most collision detection

but if someone knows i'd be curiouos to kno
Sponsor
Sponsor
Sponsor
sponsor
Hikaru79




PostPosted: Thu Jun 02, 2005 7:23 pm   Post subject: (No subject)

McKenzie wrote:
Second I'm not sure anyone who has posted knows how to use whatdotcolour in Java.

Well, it's my experience that if someone is given what they think is an easy way, they'll take it. But since Spartan seems to have taken care of it already, there's no harm Smile

There's a "Robot" class in the Java standard library (starting from 1.4.2 and up) that can do this. It has a method, "getPixelColor(int x, int y)" that will return the "Color" object of the corresponding pixel. I think you need to pass a particular Graphics object in as the Screen in the constructor, or else "Robot" will take the entire screen into calculation (since the "Robot" class is meant for doing things involving controlling keyboard/mouse movements for automated demonstrations, etc).

If you can't pass in a Graphics object to the Robot, you can use a particular component's "getLocationOnScreen" method and just subtract the two values to get the co-ordinate relative to the component's top-left corner.
Spartan_117




PostPosted: Fri Jun 03, 2005 8:26 am   Post subject: (No subject)

Robot eh? interesting name. Well thx ne ways. and dont worry people, Mr. McKenzie already knows i'm not using whatdotcolour for collisions any more.

thx
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 2 of 2  [ 18 Posts ]
Goto page Previous  1, 2
Jump to:   


Style:  
Search: