Change Image with Change Attribute?
Hello,
to save a big amount of rules, my idea is to change my images not with the ChangeImage behavior, but instead of this I will use the Change Attribute behavior like this:
But...
How I can change the number?
The number ad the end of the image name is a attribute (GUINumber(int))
So the Name looks like
to save a big amount of rules, my idea is to change my images not with the ChangeImage behavior, but instead of this I will use the Change Attribute behavior like this:
Change Attribute:>self.image = MyImageName_1.png
But...
How I can change the number?
The number ad the end of the image name is a attribute (GUINumber(int))
So the Name looks like
MyImageName_GuiNumber.png
I see the before a while ago here in the forum or on youtube, but I can't find anymore.
Anyone know the syntax for this??
Thanks in advance
Bernd
Comments
The syntax for this would be:
self.image = MyImageName_..GUINumber(int)..".png"
The double dot is really useful for concatanating attributes with text, etc.
Maybe just in case of a problem, don't use the underscore (_), so it'd be a bit cleaner:
self.image = MyImageName..GUINumber(int)..".png"
----------------------------------------------
http://davidgriffinapps.co.uk/
""You are in a maze of twisty passages, all alike." - Zork temp domain http://spidergriffin.wix.com/alphaghostapps
many thanks for helping me out.
Works great, the underscore don't stop the show. If I ran in trouble with this I can rename the files and change the filenames in the xml, but.. just for the case.
Anyway, THIS is a great way to shrink the rules to a minimum.
Thanks again Giro!
Bernd
I have 20 images, named 00.PNG to 20.PNG.
If I want to change the actor's image to the next number, what should I do with my rule?
What I don't understand is when you said: "The number ad the end of the image name is a attribute (GUINumber(int))"
What is a GUINumber?
When I try to go to the next image I'm getting only a white square. If I could understand the the GUINumber thing I think I can get it. Currenty I am doing it with change image behiavior. Thanks!
Thanks.
then changeAttribute: self.image TO: self.Image+1
for several imageAnimations: make names of the image of the sequence in double digits: … 10 through 19; 20-29; etc.
@};- MH
It's working and I saved 19 rules.
why are you saving those 19 rules? toss them out! 8-|
forgot to tell you to have the image changes enclosed in a
Rule: when (All)
Attribute: self.Image ≥ 0
Attribute: self.Image ≤ 9
--then do the changeAttributes
don't want the computer to keep on adding and then display a 20.png image.
@};- MH
thanks again