xus
xus

Reputation: 2607

Andengine sprites strange behaviour

I have created a little screenmanager (to handle multiple scenes), where every class extends from a custom class called Screen, and does the following (for example) in its load method:

public Scene load() {
    BitmapTextureAtlas mBitmapTextureAtlas = new BitmapTextureAtlas(512, 1024, TextureOptions.BILINEAR_PREMULTIPLYALPHA);
    SceneManager.loadTexture(mBitmapTextureAtlas);

    scene.attachChild(bgSprite);

    return scene;
}

The problem is that sometimes, if you move fast among screens, some sprites are not being rendered, sometimes they are (it depends on how fast I switch between scenes).

I guess the problem might be that I'm attaching the sprites to the scene when they still have been not fully loaded in memory. Can it be? Any idea how to solve this problem?

Upvotes: 1

Views: 269

Answers (1)

Farooq
Farooq

Reputation: 426

Yes it happens if you move across scenes, so you can set boolean flags for sprites. if true then perform operations. It is specially useful when perform collisionDetections.

Upvotes: 1

Related Questions