Attribute names - boolean, integer, real, etc
Lokitoes
Member, PRO Posts: 187
Hi all!
I am a beginner to GS and also lacking in some basic mathematics skills so I was wondering if there is a good source/tutorial that goes into more detail about these different types of attributes named in the discussion title, and different instances in which you would choose them? I understand that in general boolean means only true or false, and I think integer means whole numbers and real means it can have a decimal point. But I can't think of many examples where one would be used instead of the other (particularly with real and integer), which means I get stuck setting up attributes because I'm not sure which one to put my attribute under.
And I am even worse with text, angle, and index - I don't know what they are for at all. I've looked through the cookbook tutorials, but haven't found what I'm looking for.
Cheers
A
I am a beginner to GS and also lacking in some basic mathematics skills so I was wondering if there is a good source/tutorial that goes into more detail about these different types of attributes named in the discussion title, and different instances in which you would choose them? I understand that in general boolean means only true or false, and I think integer means whole numbers and real means it can have a decimal point. But I can't think of many examples where one would be used instead of the other (particularly with real and integer), which means I get stuck setting up attributes because I'm not sure which one to put my attribute under.
And I am even worse with text, angle, and index - I don't know what they are for at all. I've looked through the cookbook tutorials, but haven't found what I'm looking for.
Cheers
A
Comments
Boolean = true or false (or 1 or 2)
Text = stores text
Integer = whole numbers only
Real = numbers with decimal places
Angle = numbers between 0-360 (has a built-in modulus function which loops at 360)
Index = positive integers
Examples: A 'real' attribute could store a precise location on the screen, an integer would be quantized to the nearest pixel. If you had a game where a ball had to bounce to a certain height, the ball that went to 145.32 would beat the ball that went to 145.11 - if these scores were stored as an integer they would (wrongly) draw. Text is obvious enough, it's for storing text ! Someone enters their name or chooses a letter in a spelling game - and if you needed to save it - then you'll want to store it in a text attribute.
Angle . . . meh . . . useful up to a degree (I don't charge for the these jokes, they're free), but I never use it, you can do most of what you need with 'real' and 'integer' - even with angle / circle stuff.
Index, not too sure when you'd use it as their are maths functions ('abs' and 'floor' come to mind) that essentially can make 'real' and 'integer' attributes do what a 'index' attribute does.
Guru Video Channel | Lost Oasis Games | FRYING BACON STUDIOS