buy/equipped/unequipped buttom for the store

tiestotiesto Member Posts: 122
hello everyone
I do a buy actor for my store
but
I want when I touch my buy actor the actor image change to equipped and when I touch this actor a 2nd time the actor image change to unequipped image and when i touch a 3rd time the actor image change to equipped
finaly I want when the actor image is equipped and when I touch it the image change to unequipped and when the actor image is unequipped and when I touch it the image change to equipped.

thank you

Comments

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

    Hello @tiesto Here's the programming for toggling between two states, "never-ending"

    Rule: When touch is pressed
    When toggle is false
    Change Image [to] equipped
    Change Image toggle to true
    Otherwise
    Change Image [to] unequipped
    Change Image toggle to false
    ------

    If you mean only a certain amount of times, then make an integer attribute, let's call it Count.

    Rule: When touch is pressed and Count < 4
    Rule(nested): When toggle is false
    Change Attribute Count to Count+1
    Change Image [to] self.equipped
    Change Image toggle to true
    Otherwise
    Change Attribute Count to Count+1
    Change Image [to] self.unequipped
    Change Image toggle to false

    ---------

    By the way, I've just deleted two other threads which are identical to this one. Please don't make duplicate threads; it's against Forum rules.

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

  • mounted88mounted88 Member Posts: 1,113
    Wow I've never read something with that many equip and unequip in it before.

    Make a true/false attribute for each actor

    Then make a rule that say if true change image to equipped / if false change image to unequipped.

    You would need images that say equipped and unequipped on them, for each actor.
  • tiestotiesto Member Posts: 122
    thank you but I think that I found a better method .
    I will test it and tell you if it works
  • tiestotiesto Member Posts: 122
    so I found an other method but I don't know why it don't work
    it only show me Unequipped. The image doesn't change
    so:
    when touch is pressed
    change counter (real) to 1
    when counter=1
    change image: Equipped
    when counter=1
    touch pressed
    change attribue counter to 0
    when counter attribue=0
    change image : Unequipped
    when counter=0
    touch pressed
    change counter to 1

    this is what I do so please explain me why it doesn't work
    or if you have an other idea post it

    thank you
  • tiestotiesto Member Posts: 122
    edited April 2013
    I change when touch pressed by when buttom a is down for when counter=1 and
    by when buttom b is down when couner=0 and it works perfectly
    so I think that the problem come from there
    don't tell me to let it like that because I want to touch the buttom
    thank you
  • tiestotiesto Member Posts: 122
    I need help please
  • tiestotiesto Member Posts: 122
    no answers...... I'm alone :-<
    :((
    please help me
Sign In or Register to comment.