Conditions / Behavior - Change attributes

TitamTitam Member Posts: 20
edited June 2012 in Tech Support
Hi Guys,

Ok, I'm new here so... be kind to me please :) (and french, so it won't help, I know ^^)
I'm trying some stuff, and have issues with conditions. See here one of my tests : http://www.casimages.com/img.php?i=120607044538905229.png

And when I try, it doesn't work. I tried many ways (by using otherwise stuff, I also found here a video to explain a kind of "On/OFF" with attribute but doesn't work neither, etc.) and the result is simple : it works after many click to change the pics color (which is strange)... or it blinks. Since I need this behavior to change attributes, and I want to be sure the system works.

What I want is : One click, Green, another click, "normal" color.

Thanks by advance for your help dudes.

Best Answer

  • MotherHooseMotherHoose Posts: 2,456
    Accepted Answer
    @ Titam … Welcome to GameSalad!

    Rule: when
    Event: touch is pressed
    -Rule: when (this is a nestedRule … in the touchRule … in the behavior field)
    -Attribute: self.Color.Red =1
    --changeAttribute: self.Color.Blue To: 0
    --changeAttribute: self.Color.Red To: 0
    -Otherwise:
    --changeAttribute: self.Color.Blue To: 1
    --changeAttribute: self.Color.Red To: 1

    image MH

Answers

  • MarkOnTheIronMarkOnTheIron Member Posts: 1,447
    and french, so it won't help, I know ^^)
    Yes, that won't help ;)

    Try:

    Rule
    -When touch is pressed
    --Change attribute self.Red to (self.Red+1)%2
    --Change attribute self.Blue to (self.Blue+1)%2

  • TitamTitam Member Posts: 20
    and french, so it won't help, I know ^^)
    Yes, that won't help ;)

    Try:

    Rule
    -When touch is pressed
    --Change attribute self.Red to (self.Red+1)%2
    --Change attribute self.Blue to (self.Blue+1)%2

    Hey there, Thanks !
    I tried this but... when I try... the Creator crashes (and now I cant launch the project anymore XD)
  • TitamTitam Member Posts: 20
    Works, thanks... I was sure I tried... Why the AND in the same Rule doesn't work ?
    However, thank you very much both of you :)
  • MarkOnTheIronMarkOnTheIron Member Posts: 1,447
    edited June 2012
    Hey there, Thanks !
    I tried this but... when I try... the Creator crashes (and now I cant launch the project anymore XD)
    It works for me. Here's a quick demo. Actor 1 is my method and Actor 2 is MotherHoose's.

    https://dl.dropbox.com/u/8244920/ActorColors.zip

  • TitamTitam Member Posts: 20
    Indeed... I can open the file you sent and it works.
    Well maybe something else is wrong in the project file I can't open anymore. Whatever, thanks again for you answer ^^ I'll "redo" what I did ^^
  • MarkOnTheIronMarkOnTheIron Member Posts: 1,447
    You're welcome :)

Sign In or Register to comment.