1
\$\begingroup\$

Suppose you have justTouched or isTouched method multiple times in your game screen, is that bad? Is it better to create booleans and as few input listeners as possible? or it doesn't matter?

\$\endgroup\$
3
\$\begingroup\$

You can reference justTouched or isTouched as much as you like. I'd be surprised if they reevaluated on every call during a single frame. However, even if they were reevaluated each time you called them, it's likely to be one of the least of your performance concerns.

Make your game, then worry about these little optimizations later, when you're profiling the game to improve performance.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.