How can I have a bonus item that is not on every level?

jckmcgrawjckmcgraw Member Posts: 647
edited April 2012 in Working with GS (Mac)
Hello,

This is a very specific question, so if I'm not giving enough detail, please say so. Here it goes...

I have 3 worlds with 15 lvls on each, and I want 3 bonus items on each world. These bonus items will all be on separate levels. There is a running total of all bonus items which is called game.bonus. In a level with the bonus item, when the main character collects it, it turns attribute game.bonuslvl to true. When you beat the level, if game.bonuslvl is true, then it does:

Change attribute: game.bonus -> game.bonus +1. Everything works great, except if you replay the level. You can continue to play the same level every time, and continue to get more bonus items.

To try and fix this, I added a self attribute to the bonus item called self.bonus#, but I don't know how to use this. Somehow I need my app to recognize that a bonus item on a specific level has been gotten, and not to count it again.

Another problem is that somebody might not be able to get bonus item #1, but they can get #2.

Any sort of help is greatly appreciated,
Jack McGraw

Best Answer

  • BSideGamesBSideGames Posts: 392
    edited April 2012 Accepted Answer
    you need to make an attribute for each item true/false

    then save that attribute
    then load that attribute in main

Answers

  • jckmcgrawjckmcgraw Member Posts: 647
    @bsidegames Darn... I was hoping to avoid that in the case that I add many more worlds, and more bonus items. Thanks you very much for the quick response!

    Jack McGraw
Sign In or Register to comment.