Randomly have your background change from night and day

Hey everyone, as you may know on Flappy Bird whenever you'd lose the background image would change randomly from night to day after the game over scene comes up, along with the bird color.

If you remember the bird had three colors and the background had two as I stated above from night and day.

Anyone have an idea how this is done? I cant find tutorials on it

Comments

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

    Unless there's something more complex you want, just have two background images called background1.png and background2.png and each time that scene loads, do a Change Attribute self.Image to "background"..random(1,2) on the background actor.

    If you want the bird color to be chosen randomly, it's the same idea: image files named birdcolor1.png, birdcolor2.png, birdcolor3.png and use Change Attribute self.Image to "birdcolor"..random(1,3).

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

  • ingamezingamez Member, PRO Posts: 41
    edited April 2016

    Thanks, Im keeping it simple for now and just keeping two images night/day then ill add more when I get used to it.

    So the background images will be as an actor right?

  • fmakawafmakawa Member Posts: 565

    @ingamez Yes. The background will be an actor

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

    The only way to display an image in GameSalad is to change an actor's image to that filename. So yes, the background images "will be as an actor" meaning that an actor in the scene will have a self.Image attribute value of whatever filename you prefer. An actor can only have one self.Image value at a time but you can change it any time you like.

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

  • ingamezingamez Member, PRO Posts: 41

    Figured it out, thanks guys :)

Sign In or Register to comment.