for every 10 attribute add 1 attribute

sveideincsveideinc Member Posts: 14
edited May 2012 in Tech Support
i have made a game where you fly up. and i made a hight score keeper. So for ever 10 attribute of height add 1 to money ?

is this possible ?

please help me

Best Answers

  • MotherHooseMotherHoose Posts: 2,456
    Accepted Answer
    you want the computer to store the last Y position where you added to the money

    add an attribute to the flyingPlayer … index … name last$Y (or anything you like)

    1st behavior in flyingPlayer … changeAttribute: self.last$Y To: self.Position.Y

    Rule: when
    Attribute: self.Position.Y ≥ self.last$Y+10
    -changeAttribute: game.Money To: game.Money+1
    -changeAttribute: self.last$Y To: self.Position.Y

    image MH
  • tatiangtatiang Posts: 11,949
    Accepted Answer
    You could also use Constrain Attribute game.money to floor(game.height/10).

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

  • MotherHooseMotherHoose Posts: 2,456
    Accepted Answer
    @tatiang … that will subtract from game.money when flying downward
    … which may be what @ sveideinc wants :)

    image MH
  • tatiangtatiang Posts: 11,949
    Accepted Answer
    @tatiang … that will subtract from game.money when flying downward
    … which may be what @ sveideinc wants :)

    image MH
    Yep, two good ways to set it up, depending on how it's intended to work. :)

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

Sign In or Register to comment.