Friday, November 11, 2011

COLLISION DETECTION IN JAVA (using Jcreator to impement simulation)?

The way to solve this is to have a function that calls itself--lets say every millisecond--to check the value of a certain variable. For example your "ted" could have two variables, x, and y, initialized at (0,0) that you either add to or subtract from as "ted" moves left and right, up and down. While this is happening, the function that calls itself is checking the values of x and y. You tell this function to ignore any calls to move "ted" up/down left/right by igning a maximum value of x and a maximum value of y. I did this in JavaScript so you should be able to do it in full fledged Java.

No comments:

Post a Comment