• Post Reply Bookmark Topic Watch Topic
  • New Topic

Increasing a number by 1. CodeRally!!  RSS feed

 
Martin vanPutten
Ranch Hand
Posts: 124
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sounds simple... however this is what I get when I have a brain fart. I need the increaseCheckpoint to increase by 1 after its already gone through the first one in the CodeRally game created by IBM. So basically when the car goes through the first checkpoint, I want it to go to the second one... this is what I have now... and everything I've done to it to make it increase with its usual way... it increase to its maximum checkpoint before it goes throught the first one making the car drive through the last checkpoint over and over again. Can anybody help me out?

 
Justin Fox
Ranch Hand
Posts: 802
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
int moveThroughCheckpoints = getHeadingTo(getCheckpoints()[0]);

instead of 0, use:

int moveThroughCheckpoints = getHeadingTo(getCheckpoints()[i]);

and if your at a checkpoint increment i, if not wait until you
hit a checkpoint.


Justin
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!