need help with tables.

guillefaceguilleface Member Posts: 1,014
edited January 2012 in Working with GS (Mac)
hi all, on each level i have a display actor, if level 1 score is 500 to display first image, if score is 1000 to display 2nd image and if is 1500 to display 3rd image. now on level 2 or higher levels my requirements points will change, so how can i use tables so it changes images according to my score requirements? or i have to click on each scene, unlock the actor and change that attribute? i already try tshirtbooth videos but i can't get it to work.

Comments

  • CodeMonkeyCodeMonkey Head Chef, Member, PRO Posts: 1,803
    Create an integer attribute that represents a counter(like the numbers you pick at the post office while you wait in line). Start that integer with a value of 1.
    i.e. self.counter = 1
    I assume your table (Let's call it LevelReqs), has an integer column with the requirements for the scores, and a text column with the name of the images (without .png).
    So something like this:
    500,image1
    1000,image2
    1500,image3 ...etc

    Make a rule that says
    Rule: If game.Score <= tableCellValue(game.LevelReqs,self.counter,1)
    --Change Attribute: self.Image to tableCellValue(game.LevelReqs,self.counter,2)
    Otherwise:
    --Timer every .01 seconds
    ----Change Attribute: self.counter to self.counter +1


    The Otherwise will increment the counter until the Rule is true, in which it has the row with the image name that you need.
  • guillefaceguilleface Member Posts: 1,014
    hi thanks for helping but i think this is to advance for me, i try to follow step by step but nothing happened. i am going to do the other way plus i don't have too many scenes, but i did run into another problem. on my level 1 when counter is 0 (star at 30) save attribute game.score key;level 1. so on my actor that display the 3 images i set to load attribute key level1 to self attribute score. so when self score is 500 display first image ,1000 second image and 1500 third image, everything works good, but say first try on level 1 i got a score of 1500 so on my menu level for level one is displaying 3rd image because is loading a score of 1500 to self score., the problem is if i retry level 1 and this time i get a lower score say 500, now back in menu levels, level1 is no longer displaying 3rd image as now is loading level 1 score of 500. how can i make it to load only when i get a best score?
  • guillefaceguilleface Member Posts: 1,014
    i forget to mention this is without using tables.
Sign In or Register to comment.