cancel
Showing results for 
Search instead for 
Did you mean: 

AnimatedImage can not work

V.H
Senior

I add three AnimatedImages in a screen, but only one can work normal.

I transplant 'Knight Hits Zombie Game' code and bring my own project, the Zombie and Head AnimatedImages can not play but the Knight AnimatedImage work normal. (The Zombie and Head show the first image but can not show the others).

18 REPLIES 18

Hello, I'm using Random function in Utils.hpp but it always return the same value.

class Utils
{
public:
    static int randomNumberBetween(int lowest, int highest)
    {
#ifdef SIMULATOR
        return (int)(lowest + (highest - lowest) * (rand() / (float)RAND_MAX));
#else
        uint32_t random = (touchgfx::HAL::getInstance()->getCPUCycles() * HAL::getInstance()->getCPUCycles());
        return lowest + (random % (highest - lowest));
#endif
    }
};

Enable the 'HAL::getInstance()->getCPUCycles()' function.

Thanks you, it's work for me. I have a different question. Now I have a ScalableImage. How can I show it twice with different position on the screen?

For example, in the FlappyBird game, the score can be 1, 11 or 1111. How can I show this with only a ScalableImage that show the number 1?

If you want to display these ScalableImages in the same time, you must used Independent ScalableImages.

It's a class in ToughGFX or you mean I must create more ScalableImage?

I believe he meant adding more scalable image widgets.

/Romain

Yes, add more scalable Image widgets.

About "scalable Image widgets display"?