Let me try and clarify from my original post (Sorry for the ambiguity):
I am relatively inexperienced in Java, having only taken an introductory semester at my University. I am currently working on my own version of
Number Munchers. The game essentially revolves around a green muncher trying to eat valid numbers (based on the level) while "bad munchers" roam about freely attempting to land in the same square as the green muncher.
My version of the game successfully implements the ability of the green muncher to move, via the KeyListener, validates answers when the space button, etc. The KeyListener sets the green muncher's new position and then call the repaint() method, allowing for the newly moved muncher to be displayed in its new position.
The problem I am running into is utilizing the "bad munchers" which are their own object. The point of the bad munchers is that they move freely, obviously without any input from the user. I have an object representing these bad munchers and store htem in an arrayList of munchers. The method I invoke to determine when a bad muncher is displayed is heavily time-based. The problem occurs when I place this method in the paintcomponent, because everytime the KeyListener is invoked and the repaint method is called, the "bad muncher" method is recalled over and over again.
Is there a way to avoid this problem? (I think that perhaps some boolean logic may be used, but am wondering if there is a better approach.)
Thanks again,
Sam