Change actor image based on scene
jon2s
Member Posts: 40
I have 15 different actors in a scene that all have the same image set in the actor. When I go to scene 2, I don't want to have to edit each instance to change the image or have to duplicate the actors for each scene or create a huge if statement for each possible scene. Is there a way that you can create a text variable or something so you can specify it on a single actor in the scene and change the image based off that variable?
i.e. variable imagename = image.png
in each actor if current_image_name != imagename
change image to imagename
i.e. variable imagename = image.png
in each actor if current_image_name != imagename
change image to imagename
Comments
game.sceneNum = 1 etc
in your actor prototype set
rule: change image to "sceneactor" + game.sceneNum + ".png"
i *think* that should change actors on scene 1 to sceneactor1.png, actors on scene2 to sceneactor2.png etc
j.
IF sceneNum = 1
Then change image to image1
IF sceneNum=2
Then change image to image2
etc...
QS
Dr. Sam Beckett never returned home...
Twitter: https://twitter.com/Quantum_Sheep
Web: https://quantumsheep.itch.io
Can't you do this via the ChangeAttribute self.Image. For example if you wanted a variety of images to be used based on which scene was loaded (Level-1.png, Level-2.png, etc.) couldn't you use logic similar to the following?
Change Attribute self.Image to "Level-"+"game.CurrentLevel"+".png"
It isn't working for me, but I'm curious if you know a way. This would keep you from having to create a bunch of rules in the Actor.
So
"Level-"..game.CurrentLevel..".png"