Question about saving attributes per level

EatingMyHatEatingMyHat Member Posts: 1,246
edited November -1 in Working with GS (Mac)
Hi,

a few simple questions on saving and loading attributes:
1. can you save multiple attributes to the same key (like a score table)
2. Can the key be dynamically generated (e.g. "level"..self.id.."Score")

In short, I want a high score for each level and want to avoid multiple nested Rules. Any easy way to do it?

Thanks,
GR.

Comments

  • StormyStudioStormyStudio United KingdomMember Posts: 3,989
    You cant as yet use word strings to build up the attribute like you mention. And I dont know of a way of saving more than one attribute in a key. This is where Arrays would be great.

    It will have to be something like: (thinking as I type)...

    Make an attribute for each level score...game.level_1_score

    Name the scenes correctly, 1,2,3,4,5,6,7,8,9

    Create a prototype actor (So it can be easily amended for the whole game), which can be in every scene, called something like THE SAVING ACTOR

    Have attributes...game.new_score, game.level_completed

    Rule:
    If this level is completed = 1

    ....
    If scene_name = 1
    ....
    Change att game.level_1_score to game.new_score
    Timer after 0.1 Change att game.new_score to 0 ...(resetting score ready for next level).
    Save attribute...game.level_1_score

    ....
    If scene_name = 2
    ....
    Change att game.level_2_score to game.new_score
    Timer after 0.1 Change att game.new_score to 0 ...(resetting score ready for next level).
    Save attribute...game.level_2_score

    ....
    If scene_name = 3
    ....
    Change att game.level_3_score to game.new_score
    Timer after 0.1 Change att game.new_score to 0 ...(resetting score ready for next level).
    Save attribute...game.level_3_score

    etc etc...

    Not ideal, but should work, ,and be easily modified/tweaked even after making lots of levels....
Sign In or Register to comment.