Help With Tables?

Hello :)

In my app, i'm using the table system in game salad to make a star system for my game. My star system is close to perfection, besides one big glitch. How my star system works is that you must complete the level in order to gain credit for obtaining the stars. If you collect a star or multiple stars(Max is 3 stars) and die, the stars reset.

Right now, the glitch i am having is this...lets say you complete level 1 with 2 stars. You go back to the level select and decide that you want to go for all 3 stars. Fortunately, if you get, lets say, 1 star and complete the level, the number of stars displayed in the level select does not change from 2, as it should. However, lets say you obtain 3 stars. If you obtain 3 stars in the level and die... the number of stars collected gets reset back to 0 in the level select, which it should not. What should happen is that the star display in the level select is unaffected like the first scenario.

In case you didn't get what i said, whats happening is that my code that says "if my star count is greater than the table's value, than change the table value to the star count" is not working properly. Whats happening is that once my star count is above the table value, the table value will keep on changing regardless if you obtained more stars the 2nd time.

What i need is a line of code that says once the table value is changed, disable the change value attribute so no other changes in the star count can affect it.

I hope this made sense and i hope someone can help me because i'm stumped!

Comments

  • GLGAMESGLGAMES SingaporeMember Posts: 988
    edited December 2012
    Not sure how to you check the amount of stars but basically you can have current.star attribute and stagesaved.star attribute inside a table. and when stage completed, you have a condition to check if current.star > stagesaved.star & stagesaved.star < 3(which is the max you can get) then change attribute stagesaved.star to current.star. So any point of time if you have already gotten 3 stars it will not overwrite the stagesaved.star value. Of course it's the same referencing these values from the table.
  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949
    If the problem is that the player can achieve 3 stars and die and it saves the 3 stars ant way, then you need an intermediate attribute (say game.StarsWhileAlive) that changes as stars are achieved. If the player dies, you just reset game.StarsWhileAlive. If the player finishes the level, you then change the table value to game.StarsWhileAlive and save the table.

    If that's not the issue, then post a copy of your rules (e.g. a screenshot) and we can go from there.

    New to GameSalad? (FAQs)   |   Tutorials   |   Templates   |   Greenleaf Games   |   Educator & Certified GameSalad User

Sign In or Register to comment.