To debug these sorts of problems, simply trace the code execution. I tend to do that with console print statements, but you can also do it with breakpoints for some sorts of problems. Basically put a print statement at the beginning of every method and in every code path that is interesting. The print statement should include information to help you understand what the values of the fields are. Then run the game and look at the console. It should tell you firstly if your code is running at all. Then it should show you exactly what the computer "thinks" as it executes the code.
You should always practice this technique as it is almost always immediately obvious why your code doesn't behave the way you expect once you trace the execution.