Conditions / Behavior - Change attributes
Titam
Member Posts: 20
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.
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
-
MotherHoose Posts: 2,456@ 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
MH
Answers
Try:
Rule
-When touch is pressed
--Change attribute self.Red to (self.Red+1)%2
--Change attribute self.Blue to (self.Blue+1)%2
I tried this but... when I try... the Creator crashes (and now I cant launch the project anymore XD)
However, thank you very much both of you
https://dl.dropbox.com/u/8244920/ActorColors.zip
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 ^^