You missed the most important part here. The given code where you add your new InputListener...
is inside your render()
method.
That's not how it should be. What it basically does is adding a new, anonymous InputListener
to your image in every single frame. All those listeners will get notified and they all add 1 to your upcounter
. Move the code to your show()
method and it should work as you expected.