It happens.
Type: Posts; User: Norm
It happens.
Does the collision test work now?
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...
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...
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.
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...
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?
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.
Did you do what I suggested in my post? What was printed? The output will help you find what the problem is.
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...