Search:

Type: Posts; User: Norm

Search: Search took 0.12 seconds.

  1. Replies
    21
    Views
    1,287

    Re: Java problem. Thread wont stop

    It happens.
  2. Replies
    21
    Views
    1,287

    Re: Java problem. Thread wont stop

    Does the collision test work now?
  3. Replies
    21
    Views
    1,287

    Re: Java problem. Thread wont stop

    Where does the code change the values of the hero retangle?
    The separate variable: heroX has nothing to do with the rectangle: hero that is used in the collision() method where you printed out the...
  4. Replies
    21
    Views
    1,287

    Re: Java problem. Thread wont stop

    That would mean that the code is not changing the coordinates of those rectangles. Check the code to see why it doesn't change the rectangle's contents.

    What values does the code use to draw the...
  5. Replies
    21
    Views
    1,287

    Re: Java problem. Thread wont stop

    The Rectangle class has a toString() method that will return the values of all 4 variables. Just use the name of the variable in the println() statement.
  6. Replies
    21
    Views
    1,287

    Re: Java problem. Thread wont stop

    Here is what I suggested:
    For example in collision() print out the two rectangles that are being tested for intersection

    if(enemy.intersects(player.hero)){
    enemy
    player.hero

    Print them...
  7. Replies
    21
    Views
    1,287

    Re: Java problem. Thread wont stop

    You will never find the problem if you don't debug the code.

    What was printed out when you added the println statements I suggested? Did you look at the printout to see if it made sense?
  8. Replies
    21
    Views
    1,287

    Re: Java problem. Thread wont stop

    Reread post #2 about what to print out. What you are printing does not show any variable's value. You need to see the values to know what the code is doing so you can work on fixing it.
  9. Replies
    21
    Views
    1,287

    Re: Java problem. Thread wont stop

    Did you do what I suggested in my post? What was printed? The output will help you find what the problem is.
  10. Replies
    21
    Views
    1,287

    Re: Java problem. Thread wont stop

    Try debugging the code by adding some println statements to print out the values of variables used to control the logic. For example in collision() print out the two rectangles that are being tested...
Results 1 to 10 of 10