Ok. I have no clue what I am doing wrong. I mean, I have done sprites before...I have created them, loaded them, played them, but this time, I can't see what I am doing wrong. In my pong game, if you bounced back and forth, a powerup or something fell down. In this case a music note came falling down. But when I do the if statement to see if it should fall down, weird things happen. if I make it if 5 bounces happened, play the sprite, and I made it fall down. But That is too short. So I'll make it 50. But then than, instead of playing the sprites, it shows the image of the sprite. Then if I make the bounces shorter like 10. It is good. If I make it higher like 20 or 100, it shows the image. Has anyone had a problem that when they played a sprite, it just showed the image. How did you get over it. can anyone see what I am doing wrong. Here, i'll include the source code for that part in the game.
if(bounces == 20)
{
playPowerUp = 1;
}
if(playPowerUp == 1)
{
dbLoopMusic ( 73 );
dbSprite ( 354, powerUpX, powerUpY, 354);
dbPlaySprite( 354, 1, 4, 200 );
dbSetSpritePriority( 354, 4 );
powerUpY++;
if(pux == 1)
{
powerUpX++;
dbPlaySprite( 354, 1, 4, 200 );
}
if(pux == 2)
{
powerUpX--;
dbPlaySprite( 354, 1, 4, 200 );
}
if(powerUpX == 250)
{
pux = 1;
dbPlaySprite( 354, 1, 4, 200 );
}
if(powerUpX == 300)
{
pux = 2;
dbPlaySprite( 354, 1, 4, 200 );
}
if(ballX >= powerUpX && ballX <= (powerUpX + 46) && ballY >= powerUpY && ballY <= (powerUpY + 50))
{
dbPlaySprite( 354, 1, 4, 200 );
dbStopMusic ( 73 );
dbDeleteSprite ( 354 );
dbPlayMusic ( 47 );
playPowerUp = 0;
}
if(powerUpY == 520)
{
dbPlaySprite( 354, 1, 4, 200 );
powerUpY = -50;
powerUpX = 280;
dbDeleteSprite ( 354 );
playPowerUp = 0;
dbStopMusic ( 73 );
}
}
The reason I have so many dbPlaySprite is becuase I was desperate and wanted to see if that would stop this problem. But it does not.
EDIT: Now after playing through the game alot, I realize that if I lose a point, such as let the ball pass me, then it is the image of the sprites
EDIT: I include the demo itself so you can play and see what I am seeing. The code looks fine and can't see why this happens to the sprite.