• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Increasing a number by 1. CodeRally!!

 
Ranch Hand
Posts: 124
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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?

 
Ranch Hand
Posts: 802
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Enjoy the full beauty of the english language. Embedded in this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic