Duplicate code in SimpleApplication/Application.java

While digging through the SimpleApplication and Application classes, looking to try implement a “slowmotion” effect for my game (still working on it :P). I found that there was an unneeded “if” statement in SimpleApplication which is already called in Application.

In Application.java update() function, Lines 561 - 562

[java] if (speed == 0 || paused)


SimpleApplication.java Lines 236 - 238


public void update() {

super.update(); // makes sure to execute AppTasks

if (speed == 0 || paused) {




AFAIK this is not needed and can be removed from SimpleApplication

No… I don’t think so.

If you are just an Application then you will need to early return from update. But if you are a SimpleApplication then you will also need to early return from update. Otherwise, you will run all of that … stuff.

…unless I’m missing something.

Not sure i understand fully what your saying

SimpleApplication calls Application’s update() function, which contains[java] if (speed == 0 || paused)

return; [/java] and then it explicitly writes it again right after it returns from executing Application’s update(), unless i’m also missing something

So, SimpleApplication.update() calls super.update() which returns early… and then SimpleApplication.update() continues processing… unless it also checks.

ah yeh, i see now doh, sorry