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\$

1 Answer 1

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\$
1

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .