How do I create an animated background?

  • For a level in a platforming game I have to make an animated background of a nightfall as the sun sets/moon rises. Ideally, it would progress as the player advances through the level so that it would be night by the time he reaches the end.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Hi You could layer a few images over the top of each other for your background and adjust the opacity at timed intervals, starting with the one on top and working through the pile. I don't know if that's the best way forwards but it would work for a gradually changing background like you describe.

  • Thanks for the reply. I was considering using a giant animated sprite on a layer with 0, 0 parallax to simulate the animated background. However, I think that that way adjusting the animation to match the progess would't be possible.

    Is there a way to time events in fuction to certain points of the progess bar in order to get a gradual effect?

  • i have idea for your problem, to know the progress you must compare the the player.X and the layout right edge , now using simple equation you can know the percentage of progress in the level , you can use this to make the bar and the background effects , how to make the background :

    you have the layout width and , using the percentage from the level progress you can know the position of the sun,

    for example if the you are in 20% of the level you know that the sun.X = 20% of the layout width.

    this is the basic idea , you can extend it to make sun and moon , and for the background color just a sprite with different frames colors.

  • Thanks! I'll try to implement it this way.

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