Changing backgrounds, best way to program

pizzasmilepizzasmile Retro-WorldMember Posts: 6
edited February 2014 in Working with GS (Mac)
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)

Comments

  • TheGabfatherTheGabfather Member Posts: 633
    edited February 2014
    maybe up to a few hundred images
    We might have a problem here. A few hundred images (background images, at that) will bloat your project file a whole lot. Consider using a few base images for the general background(s) and make use of smaller Actors that you can reuse and customise your scene/background with.

    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! :D
  • pizzasmilepizzasmile Retro-WorldMember Posts: 6
    Thanks for you reply :)

    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?
  • zzap64zzap64 Member Posts: 405
    edited February 2014
    One app I created contained 360 large, almost full screen illustrated pages for a kids book. It squeezed into 50 to 80 meg total app size dependent on the hardware. Lots of optimization. However the biggest issue I had at the time was system RAM, all those images in memory didn't work so I had to look for alternative solutions.
  • pizzasmilepizzasmile Retro-WorldMember Posts: 6
    Thanks for that zzap64. I didn't think about the effect on mobile device RAM too. I guess I'll have to rethink my idea and tweak it a bit... o well! :D
  • TheGabfatherTheGabfather Member Posts: 633
    @pizzasmile

    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').
  • zzap64zzap64 Member Posts: 405
    If I remember correctly, resetting the scene between various points helped to alleviate the RAM buildup.
  • pizzasmilepizzasmile Retro-WorldMember Posts: 6
    Thanks for all your help, I'm going to do some experiments based on your ideas and see if it's possible or too RAM intensive!
Sign In or Register to comment.