I know this is obvious but my mind is not working. Simple 3 settings button?

StormyStudioStormyStudio United KingdomMember Posts: 3,989
edited November -1 in Working with GS (Mac)
Ok, its either cause I've got carried away with too many rules, not enough sleep or its actually due to gameSalad being too fast... but here's my problem.

I have a locked switch button, which changes state depending on an attribute.

If the attribute = 0, then the locked switch is off with no key in it.

If the attribute = 1, then the locked switch is off with a key in it.

If the attribute = 2, then the locked switch is on with a key in it.

If the attribute = 3, then the locked switch is off with a key in it. (this is needed along with attribute 1 for other reasons).

The problem I'm having is when the lock is touched (with the key), it cycles through the switch being on and off, and playing the short animation sequence turning the key on and back off.

I've tried putting timers in, putting each attribute rule in a separate if touched rule....

But for the life of me I can't get it working..

If its plainly obvious can someone please point it out to me...

Thankyou...from a tired GameSalad addict watching Die Hard 2.0 whilst working on my game...nearly ready for an early first beta launch...

Comments

  • StormyStudioStormyStudio United KingdomMember Posts: 3,989
    thanks...I'll keep tinkering with it if it's not overly obvious what the answer is...

    Be a fair bit of work trimming the project down to send over.

    Thanks for the offer though...
  • gyroscopegyroscope I am here.Member, Sous Chef, PRO Posts: 6,598
    Hi stormy; I often get boggle-eyed at the computer too! From what you've said, is the change attribute actually in the switch button's Rules? So perhaps if you've got change att.Switch to Switch+1, it's somehow cycling through all of them. So putting the change of attribute outside of it somewhere, i.e triggered from outside with the actual attribute number, will solve it for you. Can't think what else it could be at the moment...

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

  • StormyStudioStormyStudio United KingdomMember Posts: 3,989
    Gyro...that would make a lot of sense... I'll do that..

    Well I think it will work...my mind is really too fried to work out how to do what I'm sure is a simple function..
  • StormyStudioStormyStudio United KingdomMember Posts: 3,989
    nearly got it working, keeping all the rules on the button...still being a little bit special...

    ended up doing the normal thing of making a display text actor, to show what the attribute was doing.

    Turned out it was working, but the animation and the image change was/is not playing ball.
  • gyroscopegyroscope I am here.Member, Sous Chef, PRO Posts: 6,598
    Glad you've got it working again! Maybe consider some sleep at some time! (Sleep? What's that? ;-)

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

  • GamersRejoiceGamersRejoice Member Posts: 817
    Sleep is overrated, or is it? I don't know anymore.
  • MotherHooseMotherHoose Member Posts: 2,456
    index the images

    when event happens change index

    on your place holder for the lock:
    [Rule]
    when imageIndex = 0
    --changeImage To: 0 (no key)

    [Rule]
    when imageIndex = 1
    --changeImage To: 1 (off with key)

    [Rule]
    when imageIndex = 2
    --changeImage To: 2

    and so on for each state
    ===
    then when key overlaps/collides with lock changeAttribute game.index To: 1
    ===

    back to Lock
    [Rule]
    when touch is pressed
    --changeAttribute index To: 2
    --[Rule]
    ---when index = 2
    ----do this (play animation... and think the lock and key image should be one image)
    ----changeAttribute index = 3

    MH
    PS since I drink wine ... all the beer goes to you!
Sign In or Register to comment.