I'm currently making an asteroids game, and when the player hits one of the asteroids it is supposed to split into two smaller asteroids. To achieve this I have made a create function inside the asteroid class. Whenever the players hits an asteroid the create function is called twice which creates an asteroid and then rescales it depending on what the value of the size variable is.
The problem is that when the asteroids are scaled they cover practically the entire screen for a very small amount of time (under a second) before they are properly scaled.
I have tried hiding the sprite using dbHideSprite before it is scaled and then using dbShowSprite after the sprite is scaled but that didn't help.
Any help would be greatly appreciated!
dbCreateAnimatedSprite(asteroidName, "Media\\asteroid.png", 8, 1, asteroidName);
dbSprite(asteroidName, positionX[asteroidName], positionY[asteroidName], asteroidName);
if (size[asteroidName] == 0)
{
dbScaleSprite(asteroidName, 40);
}
else if (size[asteroidName] == 1)
{
dbScaleSprite(asteroidName, 75);
}
else if (size[asteroidName] == 2)
{
dbScaleSprite(asteroidName, 125);
}
else if (size[asteroidName] == 3)
{
dbScaleSprite(asteroidName, 200);
}