Jump to content
  • Advertisement

Archived

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

CannoN346

Player score

This topic is 6090 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

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
Advertisement
Just guessing that for a pacman game your levels are a big 2d array. Let the squares have a value of 1, and change them to 2 once you go over them. Then you only update the score if the current square is equal to 1.

Share this post


Link to post
Share on other sites
quote:
Original post by CannoN346
DAMMIT!

Yet another reason to place spaces between your code tokens. Observe:
index = 0; index < MAX_SQUARES; ++index



I wanna work for Microsoft!

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

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!