multiple images
craps
Member Posts: 353
I am able to use the touch rule and change image attribute to change to a new image. How can I do that multiple times?
Comments
Thanks
I have two seperate images on the screen and if touched one image will change. But if I touch it again nothing will happen. If I follow with a second image change attribute both images change at the same time.
then create a rule that says when attribute "image changer" = 0 rule when touched change image to blankedy blankedy, change attribute "image changer" to 1
then create another rule that says when attribute "image changer" = 1 rule when touched change image to blankedy blankedy, change attribute "image changer" to 2
you keep doing that over and over again until you get to 5 and then when that ones touched change attribute "image changer" back to 0 and that will loop it
A side note, I'm sure there are other ways of doing it (probably more processor efficient), but this is what worked for me. Good luck!
-Will
Yep no problem, there might be some books or tutorials to get you started (don't know of any, but google might be able to clear that up for you), but I found the best way to learn is just by digging in, making games, reading the support tab (alot of questions have been answered there) watching tutorials (there are quite a bit on youtube) and downloading other peoples templates, theres not really a right way to learn it, and yes for complicated things you just can't wrap your head around asking on the forums. Good luck!:)
-Will
CREATE THIS AS AN ACTOR ATTRIBUTE?
create a rule that says when attribute "image changer" = 0 rule when touched change image to blankedy blankedy, change attribute "image changer" to 1
DO I CREATE A RULE FIRST THEN CHANGE ATTRIBUTE?
Hope i am making some sense here - I am trying to figure this out. Thanks
no create it as a game attribute, under one of your scenes click on attributes, add new, integer
"DO I CREATE A RULE FIRST THEN CHANGE ATTRIBUTE?"
create a rule and change the attribute inside the rule (make sure you use the timer (previous post))
Good Luck!
-Will
___________________________________________________________
(JetPacked!) http://itunes.apple.com/us/app/jetpacked/id361063574?mt=8
Then, in the Actor that needs to change its image, create an integer attribute named "currentImage" (without the quotes)
Set this initially to 1.
Then create a Rule in the Actor like this:
Rule
All
When Touch is Pressed
When self.currentImage < 6
-----Change Attribute self.currentImage To: self.currentImage + 1
-----Change Image To: "image"..self.currentImage..".png"
Hope this helps!
Joe
ule
All
When Touch is Pressed
When self.currentImage < 6
-----Change Attribute self.currentImage To: self.currentImage + 1
FOR THIS: ---Change Image To: "image"..self.currentImage..".png"
DO I USE CHANGE "IMAGE ATTRIBUTE" AND THEN PICK THE IMAGE2.PNG? OR SOMETHING ELSE?
THATS WHAT I DID - IT WORKS AND SWITCHES TO THE NEXT IMAGE - BUT -
I CAN NOT GET IT TO GO TO IMAGE 3.
THANKS
Rule
all - actor receives event -touch-pressed
Rule
all - attribute - self.currentimage<6
Change attribute
self.currentimage - to - currentimage+1
Change image attribute - ?
So actually:
Rule
All
When Touch is Pressed
When self.currentImage < 6
-----Change Attribute: self.Image To: "image"..(self.currentImage + 1)..".png"
However - when preview everything and "touch" the image - it changes to "image missing"
Can the next images just be under images? I have them there labeled image1.png etc.
---Change Attribute: self.Image To: "image"..(self.currentImage + 1)..".png"
Under TO: do I just type in "self.currentimage + 1" ?
Thanks -
However - when preview everything and "touch" the image - it changes to "image missing"
Can the next images just be under images? I have them there labeled image1.png etc.
---Change Attribute: self.Image To: "image"..(self.currentImage + 1)..".png"
Under TO: do I just type in "self.currentimage + 1" ?
Thanks -
image"..(self.currentImage + 1)..".png"
Do I do:
--pull down menu -" image1.png" - next pull down menu - "currentimage" then type "+ 1" ?
Crazy
Any time you see a "game.[whatever]" or a "self.[whatever]", you need to select that from the drop-down list.
Make your Rule look exactly as the one that I have above:
Rule
All
When Touch is Pressed
When self.currentImage < 6
-----Change Attribute: self.Image To: "image"..(self.currentImage + 1)..".png"
Make sure self.Image and self.currentImage are selected from the drop-down menu in the expression editor.
http://tinypic.com/r/104kpbm/5
still comes up "missing image"
I have the next image in my image folder and have made the next image an actor.
"image"..(self.currentImage + 1)..".png"
quotes and everything. self.currentImage needs be chosen from the drop-down menu
Still no image change - I am sure something small is missing. Is this this only way to do this?
I was just typing off the top of my head.
This is correct, follow this exactly:
Name your images like this: image1.png, image2.png, image3.png, etc...
Then, in the Actor that needs to change its image, create an integer attribute named "currentImage" (without the quotes)
Set this initially to 1.
Then create a Rule in the Actor like this:
Rule
All
When Touch is Pressed
When self.currentImage < 6
-----Change Attribute self.currentImage To: self.currentImage + 1
-----Change Attribute self.Image To: "image"..self.currentImage..".png"
Hope this helps!
Joe