Xp Meter

games4fungames4fun Member Posts: 185
edited February 2012 in Working with GS (Mac)
Hello all,

What i'm trying to do is create a xp meter that is a fixed size 20 width 200 height and have it be a set to a certain value based on whatever level you are. For example level 1 you need 1000 xp to get to level 2 and once you reach level 2 it restarts xp meter from 0 and then you will need 2500 xp to get to level 3. How can I make it to where the xp you earn displays in a power meter way that shows you how much is left for example in level one if you have 500 xp your xp meter will be half way full and if your level 2 if your 1250 xp it will be half way as well but the height of the xp meter will always be the same.

Thanks

Comments

  • MotherHooseMotherHoose Member Posts: 2,456
    sceneAttributes for each level index type:
    maxXP … you fill in the amount needed
    currentXP … actions/events in the game add to this

    then add the XP as it is gained
    changeAttribute: scene.currentXP To: scene.currentXP+amount of xp gained

    meterBar:
    constrainAttribute: self.Size.Height To: scene.currentXP/scene.maxXP

    i.e.: height will = the xp gained ÷ maximum amount for that level

    EX: level3 1250/2500 will be halfway (50%)

    @};- MH
Sign In or Register to comment.