Actions possible depending on image shown

AppulocityAppulocity Member, PRO Posts: 46

Hey everyone, Im having trouble with making certain actions only possible when another actor is using a specific image. Concept is 6 different colours and you can only touch the coloured object when the same image is displayed. Similar idea to Simon says. If you touch any other colour other than the one shown then the game should reset but Ive found at the moment it simply doesn't work for me. Any help would be greatly appreciated. (first GS game)

Comments

  • AlkaPPAlkaPP Member, PRO Posts: 194

    Are those 6 colors randomly changed?

    My Gamesalad Games On App Store:

    Greedy Chubby: https://itunes.apple.com/us/app/greedy-chubby/id834371213?ls=1

  • AppulocityAppulocity Member, PRO Posts: 46
    edited July 2014

    @AlkaPP said:
    Are those 6 colors randomly changed?

    Yes they are

  • AppulocityAppulocity Member, PRO Posts: 46

    So at any one time, all 6 objects are spawning randomly but you can only touch 1 of the 5, that one changing randomly

  • AlkaPPAlkaPP Member, PRO Posts: 194

    Try this:

    Create a global integer attribute, let's say Color and have your main actor (the simon says actor) carry the timer every X seconds change Color attribute to random 1-5. For each number 1-5, create a color for it, and change your main actor color accordingly.

    Now create a second actor and an integer attribute (name Self Code or something like that) only for this actor. Drag and make 5 copy of the second actor and change it Self Code for each of them 1-5.

    On the second actor, create rule, when touch is pressed And Self Code = global Color code then Destroy actor.

    Let me know if you need further help. I might create a demo file for you if I have time.

    My Gamesalad Games On App Store:

    Greedy Chubby: https://itunes.apple.com/us/app/greedy-chubby/id834371213?ls=1

  • AppulocityAppulocity Member, PRO Posts: 46

    @AlkaPP said:
    Try this:

    Create a global integer attribute, let's say Color and have your main actor (the simon says actor) carry the timer every X seconds change Color attribute to random 1-5. For each number 1-5, create a color for it, and change your main actor color accordingly.

    Now create a second actor and an integer attribute (name Self Code or something like that) only for this actor. Drag and make 5 copy of the second actor and change it Self Code for each of them 1-5.

    On the second actor, create rule, when touch is pressed And Self Code = global Color code then Destroy actor.

    Let me know if you need further help. I might create a demo file for you if I have time.

    Thanks I will give it a try. Thanks for your help

  • AppulocityAppulocity Member, PRO Posts: 46
    edited July 2014

    Still having trouble, doesnt want to recognise the changing image attribute.
    What Ive got so far is:

    Every random(2,8) change attribute: self.image to "image"..random(1,6)..".png"
    That works but then to recognise the global change ive got:
    when attribute self.image is "image1.png"
    change attribute game.image1 to true
    otherwise change attribute game.image1 to false.

    Im then using that to determine which colour is okay to touch with on each different coloured actor:
    When both actor receives event touch is pressed and attribute game.image1 is false destroy actor.

    Problem is it doesnt matter if it is showing the right colour or not it still destroys it when touched. Not sure what to change.

  • gyroscopegyroscope I am here.Member, Sous Chef, PRO Posts: 6,598
    edited July 2014

    Hi @Zenithax so it's like Simon Says but still different, is that right?

    Something like

    You've just the one large image which changes colour randomly every 2 to 8 seconds.

    Underneath, or to the side, whatever, you've 6 boxes showing the 6 colours (which could appear in the that first main box)

    The user has to choose the right colour - i.e one of these 6 boxes - which match to the colour shown in that main image.

    Is that how your game is?

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

  • AppulocityAppulocity Member, PRO Posts: 46

    @gyroscope Yep pretty much, just something relatively basic for my first game

  • gyroscopegyroscope I am here.Member, Sous Chef, PRO Posts: 6,598
    edited July 2014

    @Zenithax said:
    gyroscope Yep pretty much, just something relatively basic for my first game

    Hey, don't worry, I'm not judging your idea! Just trying to understand what you want to achieve, to see if I can help you.

    OK, if I've understood it correctly then, try this approach to see if it works for you:

    (The following is based on the assumption your possible colours are actually shown as images, rather than made with RGB colour attributes) Also not far off what @AlkaPP suggested.

    In your main actor which changes its colour randomly:

    Rule: When Go is 0
    Change Attribute Rand to random(2,8)
    Timer: After Rand seconds
    Change Attribute: self.image to "image"..scene.Rand..".png"
    Change Atribute Go to 1
    
    Rule: When Go is 1
    Change Atribute Go to 0
    

    And in each of your 6 coloured boxes, put the following, changing the number accordingly, so for the first one:

    Rule: When touch is pressed and scene.MainImage.image = image1.png
    Play Sound or Change Attribute Score to Score + 10, or etc, whatever thou want when it's the correct choice
    Otherwise
    Change Atribute Go to 2
    

    for the second one:

    Rule: When touch is pressed and scene.MainImage.image = image2.png
    Play Sound or Change Attribute Score to Score + 10, or etc, whatever thou want when it's the correct choice
    Otherwise
    Change Atribute Go to 2
    

    ETC., for the other 4 buttons.

    That should work out, I think.

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

  • AppulocityAppulocity Member, PRO Posts: 46

    Thanks very much, will give it a go! :smile:

  • AppulocityAppulocity Member, PRO Posts: 46

    Works wonderfully now, thanks very much, really appreciate the help!

Sign In or Register to comment.