How do I Spawn Different Backgrounds in One Layout?

0 favourites
  • 7 posts
From the Asset Store
Adjusting the game screen for different resolutions (Letterbox scale)
  • I'm working on an asteroids game (yes, another asteroids game) but i'd like to do things a bit different. Instead of having a single static background, i'd like to have several backgrounds to represent different parts of space. My problem is getting the players ship from background to background smoothly.

    I thought about just scrolling the background in but that would look cheesey imo. Showing the ship in hyperspace may be a good idea, but don't know how to implement that.

    Another idea would be to show a screen with certain statistics, like the time it took to pass the level, number of asteroids destroyed and times the player's ship was destroyed. I'd need lots of help with this, though, but then couldn't i just destroy that background and spawn the new one?

    Any input on this would be greatly appreciated.

  • Well I am unsure exactly how you have your game setup, or I can't really gather what you might have in your head, etc. But let's see...

    If I was to do that, I might have one background with many animation frames of the different backgrounds I plan to use. Then maybe when it's time to transition to another background I might do a quick screen flash with sound effect, then have an event change the frame of animation, and then fade the flash to reveal that the background had changed.

    It would be super simple, not take too much resource, and be effective enough to demonstrate a different phase to the player. All while staying in the same layout.

    Could work?

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • That might work. Thank you.

    Basically think of the top down asteroids. There is blackness and nothing else.

    In my game the 12 background scenes are created with different star patterns and different colors. I'd like to change the background to the different scenes as the game progresses to give a sense that the player is in a different part of space every 3 levels.

    And if i understand correctly, you're saying import the 12 backgrounds like an animation, so each scene has a different frame number. Then just load that frame number after the "screen flash". Right?

  • You can do something like this in just about endless ways... you could have an unbounded scrolling layout that creates new "background" objects as you fly along (if you nicely parallax this it would look pretty neat).

    I recently made an endless/unlimited map that generates tiles in any direction the player travels, starting from a central point (so it can go positive values as well as negative values on the "Grid") which you could also use for something similar.

    Maybe a screen capture of my events for this will help;

    Note there is a global variable called GridSize which I set to 64 in this case...

    ~Sol

  • See my example for changing background in following topic:

  • Personally, I would just set trigger boxes in the areas that need a bg change and use the Fade behavior to fade-in the new bg for that area.

  • Thank you all for the input.

    My layout is 1280, 720 with a 960, 540 window size. It's a top down view of space, ship and asteroids. The BG is black with 2 layers of stars and the top layer is just a bit brighter than the bottom layer.

    I think i will cut the star layers into 128 x 720 strips and once that "zone" is cleared, freeze the ship heading 90 degrees while playing the thrusters animation, randomly spawn and move the strips on their own layer from right to left.

    Or something to that effect. Now, all i have to do is learn how the heck to do it.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)