Page is a not externally linkable
rocknbil - 3:24 am on Feb 9, 2010 (gmt 0)
I've read this four times and it makes no sense at all. :-)
I had the second two ideas below first, but realized: I wonder if these are conflicting with keyboard event constants.
if (Key.getCode() == Key.RIGHT) { // move something right }
if (Key.getCode() == Key.LEFT) { move something left }
So first off, try renaming your variables moveLeft and moveRight, see if it makes any difference. I'm probably way off on this one, don't think left and right alone are reserved.
The other random thought in the absence of an answer is it might have to do with timing or scope, somehow. When you trace, it does take a nanosecond or two to write to the output window, which may be just enough delay to populate left and right. If that theory is true, when you remove trace, it's populating left and right "somewhere else" and that doesn't happen until it's passed this frame. This would be especially true if you have "if left == 0 do nothing" somewhere.
The other possibility, and maybe more likely, is a problem of scope. So next question up: what is the context of this code, and it's sister question, where would left and right be populated?