Archived

This topic is now archived and is closed to further replies.

CannoN346

Player score

Recommended Posts

In the score for my game, im trying to add 1 each time pacman moves over a square. But, all squares on the map are placed separately, and have a set position. So, when i go over 1, the score keeps going up if i stay in that position, even after the square is gone. What can i do to make it stay?? My code: for (index=0; index

Share this post


Link to post
Share on other sites
Ok, tried that and still nothing. Well, it just stays there now, instead of moving up at all. Can someone tell me whats wrong with my code...

for (index=0; index{
squares[index].state = SQUARE_ON;

if(Collision_BOBS(&pacman,&squares[index]))
{
Destroy_BOB2(&squares[index]);
squares[index].state = SQUARE_OFF;
}

if (Collision_BOBS(&pacman,&squares[index]) &&
squares[index].state == SQUARE_ON)
player_score+=1;
else
if (Collision_BOBS(&pacman,&squares[index]) &&
squares[index].state == SQUARE_OFF)
player_score+=0;
}

Share this post


Link to post
Share on other sites
Try this, could be wrong though since i''m kinda new to games too but i''ll try my best

  

if (Collision_BOBS(&pacman,&squares[index]))
{
if (squares[index].state == SQUARE_ON)
{
player_score += 1;
squares[index].state = SQUARE_OFF;
}
else
player_score += 0;
}



That else with the += 0 probably isn''t needed but I just copied it over from your code.

Share this post


Link to post
Share on other sites