How to make your background change after you lose?

Hello all, as you know in many games there are multiple backgrounds.

Example: A game may start with a daytime background, you play through it until you lose and you click to "restart". But when you play the game again the day background has turned to night time!

Is there a way to program your game for a background or whatever etc, that changes everytime you play the game again. Also how to do this with your character for example, your character wears blue but then you play again after you lose then your character is wearing red.

Thanks all!

Comments

  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949

    Import a bunch of images named background1.png, background 2.png, etc. Then have a behavior in an actor that is as large as the scene that does Change Attribute self.Image to "background"..random(1,8). If need be, embed that behavior in a rule that gets triggered when the game starts/restarts.

    Eight in this case would be the number of background images you imported.

    It won't always choose a different background because the random generator may repeat itself but you can instead use the "random without repeats" method (google it and include the keyword gamesalad in your search).

    New to GameSalad? (FAQs)   |   Tutorials   |   Templates   |   Greenleaf Games   |   Educator & Certified GameSalad User

  • ingamezingamez Member, PRO Posts: 41

    Wow very informative! I'll give this a try and yeah I'm not looking to having it switch from day to night everytime in that sequence, but I just dont want it being one background all the time.

    Thanks!

Sign In or Register to comment.