Understanding attributes

OaktreeGamesOaktreeGames Member Posts: 10
edited November -1 in Working with GS (Mac)
Hello all,

I'm rather new to Gamesalad. I have been able to understand a bunch of it right away but attributes seem to give me some trouble. A number of how-to's discuss how to add attributes. I understand that much. My problem is after creating the attributes. I have tried following the how-to's and have created the attributes as explained. I feel like I'm missing an important part of attribute creation though. I can create an attribute named "On the Ground" as one of the tutorials states but how do you actually tell the attributes to do what they are meant to do? By simply pressing the "+" button, creating a new attribute and naming it - that doesn't exactly tell it what it should be doing.

I am sure this is something that has been asked before but I am unable to find a way to search the forums. Is there a search function in the forums that I am missing all together?

Thanks!

Comments

  • HunnenkoenigHunnenkoenig Member Posts: 1,173
    Attributes are good to manage cross actor action.

    You need to set rules which then use the attributes.

    For example you can make a button, which if pressed, sets the attribute "make sound" to true and then you can make another actor which has the rule "if make sound is true, play mysound.ogg"

    You can set game attributes, which act trough the whole game or you can set self attributes for every actor, which then work only within that actor.
  • OaktreeGamesOaktreeGames Member Posts: 10
    Thank you for your response. I do understand what you are saying when it comes to pressing a button for boolean attributes. My main problem is understanding the attributes created for the jumping how-to below:

    http://gamesalad.com/wiki/how_tos:gsc_jump

    I created the jumping rule exactly as the how-to said to. It didn't work though. For instance, I had to create a real attribute named "ZeroTime" that is supposed to store the self.Time right before the actor starts its jump. I don't see anything in the how-to that actually links the "ZeroTime" attribute I created to doing anything with the already available attribute "Time".

    I'm just trying to make my character jump. The game is nothing like Mario but that is the style jump I am talking about I guess. I really just want help understanding how the newly created attributes such as "ZeroTime" or "InitY" know what they are supposed to be doing. The how-to's only explain to create a new attribute, name it, and then use it in a rule. That doesn't actually tell the attribute what look for.
  • OaktreeGamesOaktreeGames Member Posts: 10
    To further my confusion ...

    I thought I was making progress in understanding this better but I was wrong. In the "platform" template there are two attributes that had to be created it seems. There was one named "Facing Left' and another one called "On the Ground". The "On the Ground" attribute is clearly linked to a rule that defines what it is supposed to do. However, "Facing Left" doesn't seem to be linked to anything. How does the "Facing Left" attribute know that it is checking against the direction of the actors placement? There is no rule telling the "Facing Left" attribute what to do.

    Sorry if this is a question repeated over and over. I hope they come up with a search function for these forums soon.
  • synthesissynthesis Member Posts: 1,693
    Attributes are no more than containers to store values.
    A boolean container (attribute) will only store a value of true or false.
    An integer attribute will only store whole numbers.
    and so on...

    Then in the actor...you can use a behavior to work with those attributes.
    In the case of facing left, there may be a RULE to see if the "FacingLeft" container is true or false.
    If the container says its true...then you can use that in rule behavior to do something if it is true...and so on.

    Does this help?
  • scitunesscitunes Member, Sous Chef Posts: 4,047
    I like to think of game attributes as middlemen or even interpreters. Actor 1 is unable to communicate with Actor 2 directly. So I create a game attribute so that Actor 1 can "tell" it something. This attribute can be understood by actor 2 so the attribute passes along the "message." So the idea is that when Actor 1 is touched Actor 2 has no way of directly knowing this. But if you create a game attribute and in actor one you have a rule that says when touch is pressed cahnge attribute game.middleman to 1 you can then have a rule in actor two that says when game.middleman is true do this that and the other thing. So basically the middleman game attribute is a way to let actors "communicate" with each other indirectly.
  • OaktreeGamesOaktreeGames Member Posts: 10
    I got it now. Thanks everyone!
Sign In or Register to comment.