How to have random background every game restart?
Dell7730
Member, PRO Posts: 388
I would like to have a different static background every time we play the game, where it loads another image from a group of several images.
Best Answers
-
KevinCross London, UKPosts: 1,894
Change Attribute: self.Image = "Background_"..random(1, 5)..".png"
You'll have to forgive me as I can't remember how to write random in GameSalad as I'm at work, nowhere near GameSalad
Make sure your images are saved with a unique number in the file name i.e:
Background_1.png
Background_2.png
Background_3.png
etc. -
Approw Posts: 703
@Dell Agarpo Rename all your background imags to bg1, bg2, bg3 etc. Put a change attribute:
self.Image = "bg"..random(1,3)
that should do the trick:)
Answers
Thanks, i'll give it a try and let you know
thanks, i'll try that also
I think you need to put the file extension on the end.
@KevinCross Nope its not necessary anymore. at least it always works for me;)
Ok cool it's been a while...