Add "Power-up" every 50 pts.

game ongame on Sun Valley, California Member, PRO Posts: 79

Hey Guys,

I made an Attribute (3, integer) and called it "Power-Up." So basically you have 3 strong hits to start your game.

I would like to add an extra "Power-Up" every time the "Score" reaches 50 pts. So, at 50 points +1 to "power-up," at 100 pts +1 to "power-up," and so on... What is the best way to do this.

Thanks, David

Comments

  • SmokeyAce73SmokeyAce73 EarthMember Posts: 370
    edited April 2014

    Just add the following rule:

    • If attribute = 50

    • change attribute game.powerup to game.powerup +1


    • If attribute = 100

    • change attribute game.powerup to game.powerup +1

    And so on

    Developer For BLUNTentertainment - Feel Free To Message Me! - Free Beginner Templates!

  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949
    edited April 2014

    @SmokeyAce73 That method is fine if you only have a few intervals (50, 100, 150, 200) but it breaks down quickly if you want the player to reach 10,000 points this way. You'd need too many rules.

    Try this:

    Create an integer attribute called game.lastScore and set it to 0.

    When game.score≥game.lastScore+50 Change attribute game.powerup to game.powerup+1 Change attribute game.lastScore to game.score

    How well this works depends on your scoring system and how much you are increasing your score by each time. For example, it won't calculate multiple increases (e.g. if the score changes from 0 to 300 all at once, it will count as one increase and therefore game.powerup will be 1 instead of counting it as six multiples of 50 and changing game.powerup to 6).

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

  • SmokeyAce73SmokeyAce73 EarthMember Posts: 370

    Aaah @tatiang thanks a lot, my logic seems to just sort of... go :/

    Developer For BLUNTentertainment - Feel Free To Message Me! - Free Beginner Templates!

  • game ongame on Sun Valley, California Member, PRO Posts: 79

    Thanks Guys, I will give it a try. My score only goes up one or two pts. at a time, so I think it should work fine.

  • game ongame on Sun Valley, California Member, PRO Posts: 79

    Tatiang it works great! SmokeyAce, thank you as well for the suggestion.

Sign In or Register to comment.