Skip to main content
gamedev.net
🔒 Locked

[java] Tron in java

Started by vlovich 3 replies 1.1k views
Original Post
vlovich
vlovich
Anyone know how to check for collisions in java? I know the simplest method would just have been to check the pixel color underneath to see if it was the background or not.
mill-o
mill-o
"Anyone know how to check for collisions in java?"

actually the simplest and fastest method is to check the coordinates. collisions are by the way the same in the real world, and other programming languages as well, not just Java. it''s just the implementation that differs (slightly).
vlovich
vlovich
I guess your not familiar with tron... one player can crash into the tail of the other. And i've made this game in other languages, along with a bunch of other people i know... and we all used the same algorithm cause its the simplest algorithm. So is it possible to get the color of a pixel?

[edited by - vlovich on October 10, 2002 8:56:59 PM]
CaptainJester
CaptainJester
One way to get the color of a pixel is to use BufferedImage.

Another way is.

Robot rb=new Robot();
Color c=rb.getPixelColor(10,20);




Make it work.
Make it fast.

"I’m happy to share what I can, because I’m in it for the love of programming. The Ferraris are just gravy, honest!" --John Carmack: Forward to Graphics Programming Black Book
"None of us learn in a vacuum; we all stand on the shoulders of giants such as Wirth and Knuth and thousands of others. Lend your shoulders to building the future!" - Michael Abrash[JavaGaming.org][The Java Tutorial][Slick][LWJGL][

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.