Understanding attributes
OaktreeGames
Member Posts: 10
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!
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
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.
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.
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.
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?