I am trying to create a simple scoring function using sprite collision. I have my sprite ids defined under a seperate header and my class is in order. LEFT_SCORE is animated using a sprite sheet (obviously).
int Ball::leftGoal( )
{
int leftScore = 1;
if (dbSpriteCollision (BALL, 12))
{++leftScore;}
dbSetSpriteFrame (LEFT_SCORE, leftScore);
return 0;
}
The output I am getting is that leftScore increases as expected and the LEFT_SCORE sprite acts appropriately... But, the score never tallies. It works only while the two sprites (BALL and 12) are actually touching. After that the value of leftScore returns to 1. I am close to killing myself with a rubber mallet because I just can't think my way through how to structure the code.
I am obviously a noob and my comfort zone falls short of using pointers and other such complex concepts. Any help would be greatly appriciated.