I need your help :)

GuaveMediaGuaveMedia Member, PRO Posts: 1,262
edited November -1 in Working with GS (Mac)
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

Comments

  • RedlerTechRedlerTech Member Posts: 1,583
    Hey Alex,
    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 :D
    http://matthewredler.com
  • steve86steve86 Member Posts: 806
    Hey Alex.

    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
  • GuaveMediaGuaveMedia Member, PRO Posts: 1,262
    Okey,

    you mean first a rule then choose Attribute and tap count or I am wrong?

    Alex ;D
  • steve86steve86 Member Posts: 806
    Alex0407 said:
    Okey,

    you mean first a rule then choose Attribute and tap count or I am wrong?

    Alex ;D

    just follow those steps.. you cant miss it, let me know if you run into trouble
  • RedlerTechRedlerTech Member Posts: 1,583
    Have you had a chance to view these videos? It'll help you out a bunch ;)

    http://www.youtube.com/user/GameSaladCookbook
  • GuaveMediaGuaveMedia Member, PRO Posts: 1,262
    Okay steve86,

    text attributes are created, but where do I find the integer called text?!

    greetings
  • steve86steve86 Member Posts: 806
    I'll create a demo for you and upload it give me 5 min :)
  • GuaveMediaGuaveMedia Member, PRO Posts: 1,262
    Wow :OO

    Thank you very much :)
  • steve86steve86 Member Posts: 806
    Done, uploading now. I'll give you the link in a sec
  • steve86steve86 Member Posts: 806
    Here you go.

    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
  • GuaveMediaGuaveMedia Member, PRO Posts: 1,262
    Oh god, I don't know how to thank you :)))

    Thank you very much steve ;D

    greetings,

    ALex
  • GuaveMediaGuaveMedia Member, PRO Posts: 1,262
    Just one stupid question, where can I download it? On your link I just can play/test the app?!

    thanks...
  • steve86steve86 Member Posts: 806
    Go to the GameSalad creator and on the New+ Tab type Alex display text help. Sometimes it takes a few minutes to appear if you cant find it right now try again in like 5-10 minutes
  • GuaveMediaGuaveMedia Member, PRO Posts: 1,262
    Thank you...

    ALex
  • GuaveMediaGuaveMedia Member, PRO Posts: 1,262
    Hey guys,

    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
Sign In or Register to comment.