I need your help :)
Hey guys,
my name is Alex, I am new at programming with GameSalad and have a question!
I have a Picture of a Person and a Picture that looks like a Button. I want to programm that a Text will be showed when the button will be pressed. So far so easy, now my problem:
I want to programm different text messages that will be shown, not a single message.
For example: If I click the button, a text message appears saying "Hallo!" and if I click again a different message appears saying "Hi!" and so on?
How does this work? I really don't get it...
thank you very much,
greetings,
Alex
my name is Alex, I am new at programming with GameSalad and have a question!
I have a Picture of a Person and a Picture that looks like a Button. I want to programm that a Text will be showed when the button will be pressed. So far so easy, now my problem:
I want to programm different text messages that will be shown, not a single message.
For example: If I click the button, a text message appears saying "Hallo!" and if I click again a different message appears saying "Hi!" and so on?
How does this work? I really don't get it...
thank you very much,
greetings,
Alex
Comments
Create a self (integer) attribute called tap count
When touch is pressed, change self.tapCount to self.tapCount + 1
Then say if self.tapCount = 1, display this, if tapCount is 2... do this etc.
If you want something random then say for the first rule chance tapCount to random(1, number of texts you have set up to display)
Matt
http://matthewredler.com
Here is how to do it in a few easy steps.
1.- Create different text attributes with all the words you want to appear when the user presses the button. for example: Howdy, Hello, Hi, Hiya etc.
2.- Create an integer called selectText. (The value of the integer is = to the number of text attributes you have)
3.- Create a rule inside your background or an actor that is ALWAYS going to be inside the scene that says if selectText = 1 display Howdy, Otherwise if selectText = 2 display Hello, otherwise if selectText = 3 display Hi, and so on until you have all your text attributes.
4.- Create the rule for the button saying When button is pressed change attribute selectText to random(1,5) This is taking into account that you have 5 text attributes to choose from if you have more replace the number 5 with a higher number.
5.- You are done
Hope that helps.
Cheers
Steve
you mean first a rule then choose Attribute and tap count or I am wrong?
Alex ;D
http://www.youtube.com/user/GameSaladCookbook
text attributes are created, but where do I find the integer called text?!
greetings
Thank you very much
http://gamesalad.com/g/44335
I made the project downloadable and place some notes on there so you can change it for the texts you want.
Hope that helps.
Steve
Thank you very much steve ;D
greetings,
ALex
thanks...
ALex
I build up the programm like Steve told me, but there is one problem.
If I import your Imahe button it works, if I use a picture of myself it doesn't work
Whats the problem?
Greetings