Changing backgrounds, best way to program
pizzasmile
Retro-WorldMember Posts: 6
Hiya,
I'm very new to GS, and just trying to learn, so I was wondering if somebody could point in the right direction to create multiple backgrounds.
To explain better:- I've got an idea for a game I think would be fun to create and play which involves the background changing multiple times (maybe up to a few hundred images).
Is it better to do this as a separate scene for each image (there will be very little other info on the scene/screen) or is there a way that I am not seeing?
Hopefully that makes sense and thank you in advance for the help.
(TLDR:- Best way to randomly change/switch between a stock set of images on screen)
I'm very new to GS, and just trying to learn, so I was wondering if somebody could point in the right direction to create multiple backgrounds.
To explain better:- I've got an idea for a game I think would be fun to create and play which involves the background changing multiple times (maybe up to a few hundred images).
Is it better to do this as a separate scene for each image (there will be very little other info on the scene/screen) or is there a way that I am not seeing?
Hopefully that makes sense and thank you in advance for the help.
(TLDR:- Best way to randomly change/switch between a stock set of images on screen)
Comments
With regards to making use of different Scenes, it depends on your gameplay.
e.g. If your game is an infinite runner, then you will be forced to only use one scene for the entire gameplay. It can vary depending on the game.
The most basic way is the Change Image Behaviour which simply, automatically changes your Actor's image (i.e. one minute your BG Actor is displaying Sunrise.PNG, the next minute it is suddenly showing Sunset.PNG) -- but the change will be abrupt and you won't achieve a nice, smooth transition/effect.
You can make use of multiple Actors layered on top of each other (e.g. 2). You can play with Attributes by plugging them into Behaviours.
e.g. You can gradually change an Actor's Alpha value (transparency) from 1 to 0 using Interpolate.
Edit:
A couple random links found online to get you started:
GameSalad Layers Tutorial
How-to use Interpolate to Fade an Image in Gamesalad
The GameSalad Cookbook
Good luck and have fun with GameSalad!
Yeh I figured that would be a major issue (the size and amount of images).
Without going into too much detail as I wanted the finished game to be a bit of a surprise, it wasn't an infinite runner game where the background could keep the same/ change after a restart. I was thinking of a game based on flicking through a set stock of images.
ie. a tap on the screen would change the image, so in an ideal world the app could have a couple of hundred prestocked low quality backgrounds.
Is that something that I could achieve do you think, or would that end up being a separate scene for each, and thus make the app waaaaay too big?
If you choose to make use of a lot of images (or even just a few) consider optimising the image files. ImageOptim is one such optimisation program.
You can also look at Preloading art for your Actors (command+f for 'Preload art').