5
\$\begingroup\$

I am developing game using AndEngine. I need to place a progress bar in my game to denote time remaining in the game. Is there a built-in method for doing this in AndEngine? My searches only turned up results for Android, not for AndEngine.

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

If you simply need to have a progress bar alongside your game you can use the LayoutGameActivity which was added for that purpose. LayoutGameActivity allows you to place the andEngine View into a standard Android layout which is loaded from XML, rather than using its default layout. As mentioned in the article, this is accomplished by overriding getLayoutID() and getRenderSurfaceViewID() in your game LayoutGameActivity class.

For example:

@Override
protected int getLayoutID() {
        return R.layout.xmllayoutexample;
}

@Override
protected int getRenderSurfaceViewID() {
        return R.id.xmllayoutexample_rendersurfaceview;
}

Code fragment from the linked forum post.

| improve this answer | |
\$\endgroup\$
2
\$\begingroup\$

You could also just vary the width of a simple rectangle over time, or if you want to have it nicer, stitch together a couple of sprites.

| improve this answer | |
\$\endgroup\$

Your Answer

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