createS0ftware / angle

Automatically exported from code.google.com/p/angle
0 stars 0 forks source link

sprite.setFrame problem #15

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
I have a sub sprite extends AngleSprite, and override step function to perform 
animation like this:

    public void step(float secondsElapsed)
    {
        if(frame == roLayout.roFrameCount)
        {
            frame = 0;
        }
        setFrame(frame++);
        super.step(secondsElapsed);
    }

it works well for a short while, but then after a while my sprite disappears 
unexpectedly, I print the mAlpha in Logcat, it always equals 1.
And I'm sure my frame doesn't overstep roFrameCount.

Get confused why my sprite invisible suddenly

Original issue reported on code.google.com by rayjun...@gmail.com on 10 Sep 2010 at 6:05

GoogleCodeExporter commented 8 years ago
There isn't any reason for that.
Your code is simple. An infinite unsynchronized animation loop.
If you are sure your object will don't have any children object you can not 
call super.step

Can you reproduce this issue always?

Original comment by ipaju...@gmail.com on 16 Sep 2010 at 8:20

GoogleCodeExporter commented 8 years ago
yeah, always. I only modify Tutorial02 to add a new animate sprite, see attach

Original comment by rayjun...@gmail.com on 19 Sep 2010 at 12:47

Attachments:

GoogleCodeExporter commented 8 years ago
I noticed your texture's dimension isn't power of 2.

On my hero, I can't load textures that aren't power of 2. Maybe your device can 
render these textures but fail after a while.

Try to use power of 2 compatible textures. With the attached texture, your 
sample run fine forever on my hero.

Original comment by ipaju...@gmail.com on 19 Sep 2010 at 9:15

Attachments:

GoogleCodeExporter commented 8 years ago
However, I use another Engine:Rokon, can show picture which isn't power of 2, 
so maybe Angle should fix some code to satisfy all pictures

Original comment by rayjun...@gmail.com on 29 Sep 2010 at 1:43