Issue with an actor changing Images / Attributes

FallacyStudiosFallacyStudios Member Posts: 970
edited December 2011 in Working with GS (Mac)
I'm not sure why, but this actor is not doing what it should be doing. The code looks correct as far as I can tell.

I have 1 actor that displays different weapons. It shows one weapon at a time. When pressed it is supposed to switch to the next weapon (image wise) and change the Equipped Weapon attribute up 1. When it reaches 5 it goes back to 0. As it stands I have a global attribute called Equipped Weapon and it is 0. Inside the actor I have 6 different Rules:

Rules are if equipped weapon is = 0 AND this actor receives touch pressed it increases equipped weapon to 1 and it has a rule inside that says if said weapon is > 0 display the weapons image otherwise display a lock image (the weapon > 0 is to see if the person has found the weapon or not. When they find it it will be 1, 2 or 3)

Now each of the 6 rules look just like that except different images and the numbers are increased by one each until it is at equipped weapon 5 and it sets equipped weapon back to 0.

I don't know why, but when I click on the actor during testing it does nothing ( I also have a seperate actor beneath that displays ammo based on weapon equipped and this actor does not change at all either)

I am stumped. I have no idea as to why this actor is not reacting to touches. Any ideas? (And no the actor on the screen is the the same as the prototype)

Comments

  • JohnPapiomitisJohnPapiomitis Member Posts: 6,256
    this is how it should be:

    Rule when touch is pressed:
    change attribute EquippedWeapon to (EquippedWeapon+1)%6

    then rules in the actor when equppedweapon=0 change image to whatever
    when eqippedweapon=1 change image to whatever
    then keep going for 2,3,4, and 5
    cheers
  • FallacyStudiosFallacyStudios Member Posts: 970
    I'll give that a shot thanks.
  • FallacyStudiosFallacyStudios Member Posts: 970
    @JohnPapiomitis Thanks that worked. I understand how it worked just not sure why the other way didn't work. But thanks again
Sign In or Register to comment.