How do you create game attributes - noobie question

strangealienstrangealien Member Posts: 40
edited November -1 in Working with GS (Mac)
Here are some general questions since my background is NOT programming and I've never done any programming. I'm on the artistic side of things.

How do you learn attributes in Gamesalad? How do you know what attributes to create? Is there a list of attributes for Gamesalad? For example, if you choose Boolean, what attributes do you create? If you choose Integer, what attributes do you create? and so on. How do people here know what attributes to create and or what words to use. I mean I could "makeup" some random words and hope that Gamesalad would think that these are attributes or is there a certain logic or list that I'm not getting!? As I say, I'm NOT from a programming background and was kind of hoping Gamesalad would make it easier. I'm thinking that there must be an endless list(?) of attributes or maybe there isn't - I'm not sure.

Anyway, if anyone can shed any light on my mystery in learning Gamesalad AND be able to explain it clearly, that would be a mighty help. Maybe some video tutorials aswell. I'm kind of getting demoralised not knowing how to do things. I've looked at some of the video tutorials and documentation, but I still don't have a sense of "how" to create attributes and basically what names you give to them.

Thanks,
strangealien

Comments

  • gyroscopegyroscope I am here.Member, Sous Chef, PRO Posts: 6,598
    Hi strangealien:

    Have you a dog or a cat? I've got a dog. It has attributes. These include: small, white, pointy teeth, happy, barking mad ;-), 30cm high, 60cm long, weighs 8lbs, etc. Ideally I'd like one of the attributes to be 2 metres, being the height I'd want the dog to jump/ So these are some of my dog's attributes. Same with graphics: they have attributes, height, width, characters can have weight (density); can move a certain speed, etc.

    But in the virtual world, I can change unchangeable attributes, any of them. If I have an image of a dog, I could change it's size or density. So all these attributes in GS are variable, meaning their values can vary, depending on what you want. A size could be 200 pixels wide one minute, and if you ask it to change in the next minute, it could be 100 pixels wide.

    So attributes are variable. To be more precise, they are variables; and this is what they are known as in computer programming.

    Let's go back to the image of the dog for example. To change it's width while the game is running, I'd have to put in a Rule to include a Timer, after 60 seconds change attribute DogWidth to 100 pixels. But GS engine doesn't know what DogWidth means, or the original size to change it from. Important point here: it doesn't matter in the least what you call your variables, that's up to you; make something up that meaninglful to you. It's because an attribute hasn't been "registered" with the GS program. We need to make an attribute called DogWidth with its value set to 200 (this number is an example, it could be any number you want).

    There are 3 places where this can be done. Game attribute, Scene attributes and also Actor attributes. If you put your attributes (variables) in the game one, these will be available to you to use in Rules anywhere in the game; scene attributes anywhere in the scene, and finally, actor attributes which can only be used by the actor itself.

    Wherever they are put, there are different types of attributes: boolean, text, integer, real, angle and index. And you can choose which one to use when you press the + sign to make a new attribute.

    boolean is a computer term meaning on and off. It could also be seen as yes or no, or even left or right. An example would be a boolean attribute called LargeOrSmall (remember you can name them whatever you want). We could keep its value as 0, meaning the size is large.
    In the Rules, could say When attribute LargeOrSmall is 1, change attribute DogWidth to 100.

    text: exactly what it says: the value could be any text you like.

    integer: any whole number (0,1,2,67, 20987, -45, etc.

    real: any number with up to two numbers after the decimal point: eg; 23.67, 68.5, 45.

    Angle: an number representing an angle

    Index: still not quite certain how this one can be used!

    Basically, you interact with your attributes via the Rules where you'll find the attribute browser to select them

    I could go on, but think that's basically it. Remember you can compare different types of attributes to change something else, etc; all attributes can interact with each other.

    Example: When DogWidth is 200, DogColRed is 1, DogAlpha is .6
    Play Sound DogBark

    Any attribute value existing in the GS game from new, and the ones you make can be changed at any time. (Even the name of the attribute can be).

    Well, I'm going on a bit too much now. I hope I've not confused you and this helps. Try experimenting with the things I've written, and it'll become much clearer.

    :-)

    ""You are in a maze of twisty passages, all alike." - Zork        temp domain http://spidergriffin.wix.com/alphaghostapps

  • strangealienstrangealien Member Posts: 40
    Hi Gyroscope, thanks for giving me a detailed explanation. Actually I welcome that you've done this, because I need it set out in stone.

    You said,

    "An example would be a boolean attribute called LargeOrSmall (remember you can name them whatever you want). We could keep its value as 0, meaning the size is large. In the Rules, could say When attribute LargeOrSmall is 1, change attribute DogWidth to 100."

    The boolean attribute gives only a false/true value not "0". Is that right? because you said above "boolean for the 0 value". Plus how do we know that the value 0 is "large"? Why isn't it any other number?

    So to create an the example above:
    create attribute called LargeOrSmall (boolean or integer?) - to get the 0 value
    create attribute called DogWidth (integer?) -to get the 200 value say
    create a rule that says when: when attribute LargeOrSmall is 1, Change Attribute DogWidth to 100.
    Does the timer go before the Rule or after it or in the Rule itself?

    ok, well i tried it, but it still didn't work for me and this is supposed to be a basic lesson right!
    oh man!
  • EmrysEmrys Member Posts: 38
    Hello,
    fellow newbie and artist as well.

    I'm going to plug the Unofficial GameSalad Textbook, it has a lot definitions and examples. It has already been very helpful to me.

    I love the forums and they have been very helpful to me as well. But is very easy for people to toss a remark that regular users (or programmers) would understand but us newbs need it more spelled out.
    I book mark any post that has material I think I might need in the future.

    The next best help is the Demo/tutorial/template games. Open them up in the GameSalad editor and see how they made their rules and where they put them.

    Good luck!
  • gyroscopegyroscope I am here.Member, Sous Chef, PRO Posts: 6,598
    No worries; It's great you ask questions, that way you learn; and we all learn all the time!

    "create attribute called LargeOrSmall (boolean or integer?) - to get the 0 value"

    as LargeOrSmall is a choice between two states, i.e large or small (exactly like on or off, hot or cold, left or right, false or true, 0 or 1, etc) you only need a boolean attribute. (An integer attribute would work just as well, but boolean would be the correct attribute type to use here).

    "create attribute called DogWidth (integer?) -to get the 200 value say"

    That's correct, integer attribute it is, because you want to deal with whole numbers in that example.

    "create a rule that says when: when attribute LargeOrSmall is 1, Change Attribute DogWidth to 100.
    Does the timer go before the Rule or after it or in the Rule itself?"

    In the Rule itself. So in the actor's editor, you click on the button that says Create Rule and a rule appears. (By the way, for this little experiment, when you make the game boolean attribute LargeOrSmall, make it's value checked, meaning 1).

    When All conditions are valid:
    Actor receives event touch is pressed

    Then click the + sign at the end of this line, make new line:
    Attribute is BigOrSmall is true

    So you've asked the GS engine, when a user touches (or clicks) on your actor AND its attribute is set to true (1) then do something.

    THe do something appears as behaviours shown in the grey panel which says: Drag your behaviours here.
    First, drag a Timer behavior there, make it

    After 5 seconds

    Then drag another behavior called Change Attribute into the grey area. Click on the 3 dots, the Attribute Browser will appear and select your actor (perhaps called Dog) > Size . Width to (click on e symbol, Expression editor appears, choose Game. DogWidth) game.Dogwidth.

    That'll change your picture to 200 pixels wide after 5 seconds. (You could make it grow to 200 over time with another Behaviour called Interpolate)

    Hope you'll see the potentials in this little test; the more you experiment with attributes and Behaviors, the more you'll get to happen. It's all down to practice, practice, practice, trial and error and more practice!

    :-)

    ""You are in a maze of twisty passages, all alike." - Zork        temp domain http://spidergriffin.wix.com/alphaghostapps

  • MotherHooseMotherHoose Member Posts: 2,456
    @gyroscope... that was just Magnificent! you could have gone on for pages... and I would have loved it!

    I will add:

    We use Attributes to store information (data)
    Computers use the data in Attributes to execute events.

    You can create attributes in the Game
    (global: which are accessible and changeable by all the actors and other globals in your game)

    You can create attributes in the individual Actors
    (local: which are accessible and changeable by only that actor and that actor’s attributes.)

    The Attribute Type you select for your created attributes defines how a computer stores and how a computer uses/manipulates that data.

    When you are in the Attribute Section and create an attribute with plus sign [+]
    ... there are 6 Attribute Types to select from:

    Boolean
    two alternate states of existence
    either/or
    computers read 0 or 1
    we write false or true
    our created attribute displays a box that we click on to change the state
    unchecked is false
    √ is true
    use to control if an event can or cannot happen
    or has or has not happened

    Integer
    any number or fraction thereof
    fractions are decimal fractions
    can be a positive or negative number
    computers manipulate Integers using the operants ( +, -, *, /)

    Text
    a letter or combinations of letters
    basically what you can type in on your keyboard
    (can also include numbers and punctuation)
    use to store user input or your assigned text

    Real
    stores numerical data that actually exists
    Computers read the data called for and store it in the attribute
    use to store your X, Y data; color values; time data; width and height; and etc.

    Angle
    degrees of an angle
    an angle is the degrees of separation between 2 intersecting lines
    maximum degrees is 360
    (we reference with the numbers between 0 and 359)
    use positive numbers for clockwise rotation of the lines/edges
    use negative numbers for counterclockwise rotation of the lines/edges
    you use angles in math calculations such as trajectories

    Index
    think of this as a 1 column (or row) array structure
    you make a list and reference the items on your with positive whole numbers
    use to track/manipulate items; scenes; image display; objects selected; and etc.

    ===
    you can name an attribute anything you want... but is best to have a descriptive name that you will recognize.

    MH
    PS I sorta think of an Index as referencing more states of being than a Boolean... either/or/or this/or that/
  • gyroscopegyroscope I am here.Member, Sous Chef, PRO Posts: 6,598
    MotherHoose said:
    @gyroscope... that was just Magnificent! you could have gone on for pages... and I would have loved it!

    Glad you liked it, MH! I enjoyed teaching people...15? 18 years ago? Can't remember, lost in the mists of time! When I had my own graphic design business in the 90's I also freelanced on other people's machines/premises, including training on Photoshop, Illustrator, Quark XPress and Word. I used to thoroughly enjoy that aspect.

    Excellent additions!

    :-)

    Ps strangealien: as Emrys wrote, you can't go wrong by purchasing Photics ebook. I haven't a copy of it myself, but buyers have reported that it's excellent.

    ""You are in a maze of twisty passages, all alike." - Zork        temp domain http://spidergriffin.wix.com/alphaghostapps

  • strangealienstrangealien Member Posts: 40
    So here's what I did: created an actor (square default one) The actor size itself is the default 100x100.

    under Game attributes:
    created boolean attribute for LargeOrSmall (checked to 1)
    created DogWidth attribute (Integer value of 200)

    then went to Create Rule
    when touch is pressed
    clicked + at end of the line
    then Attribute, clicked on the 3 dots, then selected Game, LargeOrSmall is true.
    then dragged Timer into Rule
    After 5 secs (do I check Run to Completion ?)
    then drag Change Attribute behaviour into Timer (where is says Drag your behaviours here)
    then select the 3 dots,Game,DogWidth
    then press e symbol, Game,DogWidth (it reads game.DogWidth) - this part doesn't seem right. (Should I have made Dogwidth under Actor attributes?) or do I need to +200 after the game.DogWidth ?

    It still shows my square in the middle of the screen when I preview and doesn't change size. What am I doing wrong?!
  • strangealienstrangealien Member Posts: 40
    Hey Emrys, nice to know you aewell. Well at least I'm not the only noob posting on the forum to ask my basic questions! Thanks Gyroscope and Emrys, I've got Photics book already but found it tough reading through it without getting a sense of the basic stuff. Actually Gyroscope your explanations have been really clear so thanks a lot. Just can't seem to get my example going as my last post says. Can you shed any light on what it is I'm doing or not doing? I thought I got it right but somewhere it's not working.

    thanks, strangealien
  • EmrysEmrys Member Posts: 38
    Ummm... If you are attempting to modify the Actor1 (the square white dog), it is not connected into the process.

    None of the attributes are linked it or its width, so basically (as I see it) you are modifying an attribute that the game reads but has no way to display.

    I will poke it some more, but I am barely ahead of you on the learning curve. :D
  • EmrysEmrys Member Posts: 38
    The actor would need a constrain attribute:
    Constrain attribute: Actor1 > size > Width to game > DogWidth

    Then you could add a rule that says if clicked change attribute DogWidth +200

    I see no need in this example for the boolean attribute ...

    The boolean would be useful for something like click Actor/if LargeSmall is true (dog is small)/then change attribute DogWidth +200 //otherwise// If LargeSmall is false/ change attribute DogWidth -200

    But I think I may have confused you since I have confused myself ...
  • MotherHooseMotherHoose Member Posts: 2,456
    @strangealien

    perhaps you are making this more complicated than need be...
    (or perhaps I don't understand what you are trying to do)

    as your Dog actor already contains all the attributes the computer can change during runtime...
    you do NOT need game.Attributes to access or change the characteristics of your Dog

    on your Dog
    [Rule]
    when attribute self.Size.Width =100
    --[Rule]
    when touch is pressed
    ---[Timer] After 5 seconds
    ----changeAttribute self.Size.Width To: 200
    Otherwise:
    [Rule]
    when attribute self.Size.Width =200
    --[Rule]
    when touch is pressed
    ---[Timer] After 5 seconds
    ----changeAttribute self.Size.Width To: 100

    =====
    the self.Size.Width is added with the expression editor.
    all the Dog attributes are accessed by clicking... and the editor substitutes the 'self' for the actor's name.

    for testing purposes the 5 seconds can be long!... so make it 0.5 or 1 second...

    =====
    Now if you want to change the Dog by action/events from another actor
    then you can make a game.Attribute ... boolean if you want just large or small states for the Dog

    Create the other Actor... drag it a [Rule] when touch is pressed change that game.Attribute

    In Dog you want the computer to monitor that game.Attribute so
    [Rule]
    when game.Attribute is true
    do something...
    Otherwise:
    do something else...

    It is good that you are playing with actually doing things in GS
    If I want to figure out something I am unsure of ... I open a new project to play in... and if I get things working...I use them in my actual game project.

    this is a new language for you... the vocabulary is strange
    but just learning by doing what you need to interact with is the best way to start...

    MH
  • strangealienstrangealien Member Posts: 40
    Motherhoose,

    I did it your way and it worked for me - thanks.
    But why is it not working for me Gyroscope's way? Gyroscope, is it possible you can you upload a quick demo for me to download using the boolean and integer attributes you've explained above. I'll send you an email. I know you can use the attributes that are already there (demonstrated with Motherhoose's example) but I still want to see the outcome by creating the boolean and integer attributes for changing the width. The boolean attribute for LargeOrSmall doesn't seem to work for me. If it's checked to 1, it's saying it's large right?

    Could you lay out the exact order of steps like MH? It's the only way I can follow.

    Thanks,
    strangealien

    ps. again this is what I did before with your method Gyroscope. Let me know what I'm doing or not doing:

    under Game attributes:
    created boolean attribute for LargeOrSmall (checked to 1)
    created DogWidth attribute (Integer value of 200)

    then went to Create Rule
    when touch is pressed
    clicked + at end of the line
    then Attribute, clicked on the 3 dots, then selected Game, LargeOrSmall is true.
    then dragged Timer into Rule
    After 5 secs (do I check Run to Completion ?)
    then drag Change Attribute behaviour into Timer (where is says Drag your behaviours here)
    then select the 3 dots,Game,DogWidth
    then press e symbol, Game,DogWidth (it reads game.DogWidth) - this part doesn't seem right. (Should I have made Dogwidth under Actor attributes?) or do I need to +200 after the game.DogWidth ?
  • strangealienstrangealien Member Posts: 40
    just a quick note. Motherhoose, when I did the example and played it back in preview, the shape alternated between the square and the rectangular shape every 3 seconds. so it looped. hope this was correct?! well it changed shape after 3 seconds and then back again to the other shape.
  • strangealienstrangealien Member Posts: 40
    So if I wanted to make something jump, like my dog, would this be simple to do?
    so my thinking is something like:
    dog on x axis (200 or so along x axis) and 0 at y axis.
    then when press is touched, dog jumps in y axis.
    or when dog is on x and y axis, after 3 seconds, dog jumps.

    how would you do that? again would you need to create a boolean attribute and an integer attribute? how does GS register/recognise a jump attribute for example? would you use an interpolate attribute to make it look like it jumps into the air?
  • gyroscopegyroscope I am here.Member, Sous Chef, PRO Posts: 6,598
    Hi strangealien; I gave my example "off the top of my head" but as MH said it's perhaps a bit more advanced that the simpler version he gave. I wanted you to understand how other attributes (the boolean one) can be tied into the Rules.

    For your question above, you won't go wrong in studying the platformer template which can be found when you press the New button in the window that appears immediately after opening GS.

    Also, got your PM, I'll send out a working example of my suggested test to you some time today, no probs. I'll adjust the timer to 2 seconds as well (to demonstrate a timer, 5 seconds is still too long perhaps, as MH also said!).

    Plough on, as they say! (We'll give you the telephone number of GameSalad Addicts Anonymous at a later date... ;-)

    ""You are in a maze of twisty passages, all alike." - Zork        temp domain http://spidergriffin.wix.com/alphaghostapps

  • MotherHooseMotherHoose Member Posts: 2,456
    I think I would use an animation... to give a more realistic look to the Dog.

    MH
  • strangealienstrangealien Member Posts: 40
    Thanks Gyroscope and MotherHoose,

    Really I don't know what I'd do without your clear explanations. You've been really helpful. I was just hoping I could get my head round the boolean and integer attributes a bit more and hopefully be able to make my own attributes step by step. I feel so lost without guys like you on the forum to help me with learning GS.

    I'll keep at it! strangealien :)
Sign In or Register to comment.