How to spawn actor with a random image

thegwillthegwill Member Posts: 31
edited November -1 in Working with GS (Mac)
Does anyone know how to spawn an actor with a random image? (chosen from a set of images)

Can I use an animation to store the images maybe?

Comments

  • firemaplegamesfiremaplegames Member Posts: 3,211
    First, I would name your images like this:

    image1.png
    image2.png
    image3.png
    etc.

    Then put a Change Attribute behavior in the spawned Actor, like this:

    Change Attribute: self.Image To: "image"..random(1,[number of images])..".png"

    Change [number of images] to the actual number of images you have.
    i.e: Change Attribute: self.Image To: "image"..random(1,5)..".png"
  • thegwillthegwill Member Posts: 31
    Cool, thanks. Didn't know double period was used to concatenate strings...
Sign In or Register to comment.