Help With Table Coding?
jblb2424
Member Posts: 65
Hello
I have been trying to make a level unlock system through the use of tables. But recently i have been having trouble creating the code, so i thought i may get some help.
My game goes like this: You unlock worlds through collecting stars. I have 8 levels in a world, and each level contains 3 stars. Lets say you only need 15 stars total to unlock the next world. However, lets say you are up to level 5 and collected 2 stars in level 5....but you die before finishing the level. The amount of stars you collected ONLY in level 5 will reset back to 0. The past levels that you completed remain unchanged. You do not need any stars to complete a level,though. So once you collect 15 stars out of 24 stars collectively(3 stars times 8 levels equals 24) The next world is unlocked.
How can implement this system in my game? I already did the code for the star collection system, so i just need to know how to correlate the star system with my level unlock system. If you need any additional info about my game feel free to leave a comment below. Any suggestions? Thanks!
I have been trying to make a level unlock system through the use of tables. But recently i have been having trouble creating the code, so i thought i may get some help.
My game goes like this: You unlock worlds through collecting stars. I have 8 levels in a world, and each level contains 3 stars. Lets say you only need 15 stars total to unlock the next world. However, lets say you are up to level 5 and collected 2 stars in level 5....but you die before finishing the level. The amount of stars you collected ONLY in level 5 will reset back to 0. The past levels that you completed remain unchanged. You do not need any stars to complete a level,though. So once you collect 15 stars out of 24 stars collectively(3 stars times 8 levels equals 24) The next world is unlocked.
How can implement this system in my game? I already did the code for the star collection system, so i just need to know how to correlate the star system with my level unlock system. If you need any additional info about my game feel free to leave a comment below. Any suggestions? Thanks!
Comments
For the World 2 selection button:
When Touch is Pressed
.....Change Attribute self.stars to tableCellValue(StarCountTable,game.currentWorld,1)
When attribute self.stars >= 15
.....[change scene or whatever rule you do to start or unlock the next world]
If the number of stars needed in each world is different, you can also store this in the same table (e.g. column 2) and then replace the 15 above with a tableCellValue expression.
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User