Do different events with every touch

delorean88@aol.comdelorean88@aol.com Member Posts: 20
edited November -1 in Working with GS (Mac)
Here is my question. Lets say you have a stick figure person standing on a white background. You touch him and he waves and says hi, you touch him and he hops on one knee and says ouch, you touch him again and he falls over. Is there a way to do this? Right now I have something like this, but at the end of each event it loads another level and that next level has the one touch command. Can you have multiple touch commands on one actor to generate different responses? Any suggestion? Thanks in advance.

Comments

  • delorean88 said:
    Here is my question. Lets say you have a stick figure person standing on a white background. You touch him and he waves and says hi, you touch him again and he hops on one knee and says ouch, you touch him again and he falls over. Is there a way to do this? Right now I have something like this, but at the end of each event it loads another scene and that next scene has a different one touch command. Can you have multiple touch commands on one actor to generate different responses? Any suggestions? Thanks in advance.

  • quantumsheepquantumsheep Member Posts: 8,188
    Yes you can. Use attributes.

    You can name an integer attribute 'event' with the value 1. Every time you press the actor, change attribute 'event' to attribute 'event' +1.

    So, you touch it once, it goes to 2.

    You touch it again, it becomes 3.

    and so on.

    Then, have a rule that says:

    If 'event' = 1, do this action.

    Then another rule:
    If 'event' = 2, do this action

    and so on and so forth.

    You can even include a rule so that if you want just five different responses, it will go back to the first.

    i.e. if 'event' is greater than 5, change attribute 'event' to 1.

    These are great if you want a scripted sequence of events (i.e. 1, 2, 3, 4, 5). You can add the random feature to get a different random response.

    Instead of changing the attribute event by +1, you'd put in the rule:

    If actor is touched,
    Change attribute 'event' to 'rand(1,5)

    This chooses a random number from 1 to 5. You can keep the 'if event =2 then do this etc' rules.

    Hope that helps,

    QS :D

    Dr. Sam Beckett never returned home...
    Twitter: https://twitter.com/Quantum_Sheep
    Web: https://quantumsheep.itch.io

  • This is an amazing answer thank you, I just wish I understood it. I'm sorry, I'm a serious noob. Is there an example of this in the game samples section? This is how bad I am. I lost you here...
    "You can name an integer attribute 'event' with the value 1." How do I create an event like this? Do I name my actor "1"? I hope you are a patient person because I really want to understand this. Can you give me a step by step of just this first thing? Do I create a rule within my actor? Is it an attribute within my actor? Sorry...
  • quantumsheepquantumsheep Member Posts: 8,188
    I've uploaded an example here:

    http://gamesalad.com/game/play/79910

    Try to see where everything is - the attributes are in the left panel, under the 'attributes' tabs (where the actors usually appear - just look a little above them for the tabs).

    I've given some rudimentary instructions in each rule the actors have.

    To download the file, right click the 'download' button on the example and save it somewhere.
    Change the .game to .zip on the file.
    Double click the .zip file
    It should uncompress the file.
    double click on the uncompressed file to open it up in GameSalad.

    Good luck, Marty!

    QS :D

    Dr. Sam Beckett never returned home...
    Twitter: https://twitter.com/Quantum_Sheep
    Web: https://quantumsheep.itch.io

  • Thank you, I was inspired by your first answer and went searching, I found a tutorial from someone who randomly spawned ghosts. There is where I realized where you wanted me to create the integer. I have a random system running now, but by trial and error. I will look at your example, thanks so much for doing that. Question...I have an integer named "choose" with the value of 1, if I change the value to 2, nothing happens, why? I figured it would randomly pick 2 out of my pool rather than 1, is the value not relevant?

    Thanks Again!!!!
  • Ok, I just looked at your sample and my random "code" is pretty much identical to yours. I didn't however know how to do it in sequence, so thank you! Oh and I just realized you called me Marty....nice. "When this baby hits 88 mile per hour, your going to see some serious $#!t."

    M.M.
  • quantumsheepquantumsheep Member Posts: 8,188
    delorean88 said:
    Oh and I just realized you called me Marty....nice. "When this baby hits 88 mile per hour, your going to see some serious $#!t."

    M.M.

    Always happy to help a fellow time traveller :D

    Dr. Sam Beckett never returned home...
    Twitter: https://twitter.com/Quantum_Sheep
    Web: https://quantumsheep.itch.io

Sign In or Register to comment.