[Behavior] Parallax background for side-scrolling games

Post your completed addons to share with the community

Post » Thu Feb 02, 2017 10:03 am

Zed2100 wrote:@Zebbi I forgot that I was also offering this addon for free, that's why I talked about the free updates. I thought I was replying on the asset store thread. :D

Anyway, I will also offer the version 1.1 (the new update) for free, if you feel that this addon is adding some value to your project and if you want to support my work, please consider purchasing a license on the store.


Just bought! It's incredibly useful and I want to support development for sprites! 😬 I'm trying to do the sonic 1 for megadrive effect with the background, haven't worked out the vertical yet (it seems to squash and stretch?) but the water I've done with lots of stacked little tiles, each with the x-parallax -1 as the go up, looks quite good. I could probably use some kind of Color cycle or something for the water, but I think animated sprites would be best for this effect.
B
41
S
12
G
14
Posts: 1,117
Reputation: 11,248

Post » Thu Feb 02, 2017 11:31 am

Zebbi wrote:
Zed2100 wrote:@Zebbi I forgot that I was also offering this addon for free, that's why I talked about the free updates. I thought I was replying on the asset store thread. :D

Anyway, I will also offer the version 1.1 (the new update) for free, if you feel that this addon is adding some value to your project and if you want to support my work, please consider purchasing a license on the store.


Just bought! It's incredibly useful and I want to support development for sprites! 😬 I'm trying to do the sonic 1 for megadrive effect with the background, haven't worked out the vertical yet (it seems to squash and stretch?) but the water I've done with lots of stacked little tiles, each with the x-parallax -1 as the go up, looks quite good. I could probably use some kind of Color cycle or something for the water, but I think animated sprites would be best for this effect.


Thank you for the kind words, and for your purchase! I'm glad this addon has added value to your projects.

The update is coming very soon. I have finished the development of the animated backgrounds addon, it uses Sprites instead of TiledBackgrounds. I'm currently re-writing the manual, doing QA, and creating some examples.

The addon creates Sprites at runtime to cover the entire screen, it adds or removes them as needed in an optimized way in case the viewport size is changed (zooming in/out, screen size changes).
ImageImage
B
40
S
13
G
10
Posts: 162
Reputation: 7,571

Post » Thu Feb 02, 2017 12:01 pm

Sounds amazing, can't wait to try it! :D
B
41
S
12
G
14
Posts: 1,117
Reputation: 11,248

Post » Fri Feb 03, 2017 12:46 am

Grab the version 1.1 of the addon here
Version 1.1 (02 Feb 2017)

  • Now it is possible to have animated backgrounds!
  • The manual has been thoroughly rewritten

Check out the overview video of version 1.1 here!

Enjoy!
ImageImage
B
40
S
13
G
10
Posts: 162
Reputation: 7,571

Post » Fri Feb 03, 2017 12:51 pm

Zed2100 wrote:Grab the version 1.1 of the addon here
Version 1.1 (02 Feb 2017)

  • Now it is possible to have animated backgrounds!
  • The manual has been thoroughly rewritten

Check out the overview video of version 1.1 here!

Enjoy!


Very excited to try this when I get home from work, thank you so much! Quick question, whilst I remember: is it possible to address individual uiid of each "looped" Sprite? I haven't tried it yet, but with tiles backgrounds I would place one down the width of its image and version 1.0 would stretch the tiled background, and I believe the new 1.1 is repeating/duplicating the Sprite? The reason I ask is because Id like to randomly select a different start frame for each instance to create a star sky/water surface, can this be done? Or could it be added to 1.2?

Thanks again and look forward to trying it out later!
B
41
S
12
G
14
Posts: 1,117
Reputation: 11,248

Post » Fri Feb 03, 2017 2:40 pm

Zebbi wrote:
Zed2100 wrote:Grab the version 1.1 of the addon here
Version 1.1 (02 Feb 2017)

  • Now it is possible to have animated backgrounds!
  • The manual has been thoroughly rewritten

Check out the overview video of version 1.1 here!

Enjoy!


Very excited to try this when I get home from work, thank you so much! Quick question, whilst I remember: is it possible to address individual uiid of each "looped" Sprite? I haven't tried it yet, but with tiles backgrounds I would place one down the width of its image and version 1.0 would stretch the tiled background, and I believe the new 1.1 is repeating/duplicating the Sprite? The reason I ask is because Id like to randomly select a different start frame for each instance to create a star sky/water surface, can this be done? Or could it be added to 1.2?

Thanks again and look forward to trying it out later!


I love your enthusiasm! :D

Yes, it is possible to loop through all the sprites that are created by the addon. As for all instances in construct 2, each sprite will have its own uiid.

In your event sheet, you can control which frame the sprite starts with using the "on created" condition, or you can loop through all the instances and change their frames at will (using "for each" for example).

The addon does not change the animations in any way. The logic behind this is to give the user as much freedom as possible to manipulate the animations.

The addon will create or destroy sprites at runtime in order to fit the screen width, it will also set their position every tick. However, as explained in the manual, the sprite instance with IID = 0 (that's the one you placed in the editor at edit time) is never destroyed, it is used by the addon to set the positions of the other sprites.

In the example project, you may notice that if you zoom in then out, some toxic water sprites will be out of sync with each other, that's because new sprites were created (they start by default at frame 0) while the ones on screen were already playing their animations. The addon doesn't force the sprites to be synced, however, if you want them to be, this is easily done using the event sheet.

If you have further questions please let me know.
ImageImage
B
40
S
13
G
10
Posts: 162
Reputation: 7,571

Post » Fri Feb 03, 2017 3:06 pm

Zed2100 wrote:
Zebbi wrote:
Zed2100 wrote:Grab the version 1.1 of the addon here
Version 1.1 (02 Feb 2017)

  • Now it is possible to have animated backgrounds!
  • The manual has been thoroughly rewritten

Check out the overview video of version 1.1 here!

Enjoy!


Very excited to try this when I get home from work, thank you so much! Quick question, whilst I remember: is it possible to address individual uiid of each "looped" Sprite? I haven't tried it yet, but with tiles backgrounds I would place one down the width of its image and version 1.0 would stretch the tiled background, and I believe the new 1.1 is repeating/duplicating the Sprite? The reason I ask is because Id like to randomly select a different start frame for each instance to create a star sky/water surface, can this be done? Or could it be added to 1.2?

Thanks again and look forward to trying it out later!


I love your enthusiasm! :D

Yes, it is possible to loop through all the sprites that are created by the addon. As for all instances in construct 2, each sprite will have its own uiid.

In your event sheet, you can control which frame the sprite starts with using the "on created" condition, or you can loop through all the instances and change their frames at will (using "for each" for example).

The addon does not change the animations in any way. The logic behind this is to give the user as much freedom as possible to manipulate the animations.

The addon will create or destroy sprites at runtime in order to fit the screen width, it will also set their position every tick. However, as explained in the manual, the sprite instance with IID = 0 (that's the one you placed in the editor at edit time) is never destroyed, it is used by the addon to set the positions of the other sprites.

In the example project, you may notice that if you zoom in then out, some toxic water sprites will be out of sync with each other, that's because new sprites were created (they start by default at frame 0) while the ones on screen were already playing their animations. The addon doesn't force the sprites to be synced, however, if you want them to be, this is easily done using the event sheet.

If you have further questions please let me know.

That's exactly what I wanted to know, looking at the manual it mentions UIID's too, so I'm just going to clone a new sprite for the Y-axis with each line, and randomly change the start frame for each of the duplicates the plugin makes. Thanks again so much!! :D
B
41
S
12
G
14
Posts: 1,117
Reputation: 11,248

Post » Sat Feb 04, 2017 2:33 pm

@Zed2100 I had another idea about having a feature where you could put a sprite/background in and have a paralaxer that splits the image up into horizontal slices: Image
If you notice the background, the water has rows and rows of water, all split up to give a psedo 3d look. I can do this manually: Image but it would be incredibly convenient to have the plugin do this for me, just specify how many slices and how much to offset each slices paralax by. You could even do vertical slices for tall games.
B
41
S
12
G
14
Posts: 1,117
Reputation: 11,248

Post » Sat Feb 04, 2017 6:26 pm

Also, is there any downside to using tilebackgrounds with the spritebg effect on it? I don't think it seems to work any differently? I wanted to use paralax bg to add some paralax to some sprites that moved and they just stayed still, so I had to use wrap horizontally and put it on another layer with paralax on. It would be cool if there was a way of using the paralax with moving sprites (or tiled backgrounds that have the spacing set so they don't tile for better performance) so I can have all the background items arranged in one layer, even for props that move.
B
41
S
12
G
14
Posts: 1,117
Reputation: 11,248

Post » Sun Feb 05, 2017 2:51 am

Zebbi wrote:Also, is there any downside to using tilebackgrounds with the spritebg effect on it? I don't think it seems to work any differently? I wanted to use paralax bg to add some paralax to some sprites that moved and they just stayed still, so I had to use wrap horizontally and put it on another layer with paralax on. It would be cool if there was a way of using the paralax with moving sprites (or tiled backgrounds that have the spacing set so they don't tile for better performance) so I can have all the background items arranged in one layer, even for props that move.


The ParallaxBGSprite behavior is only for animated backgrounds that don't move, think of them like animated versions of the TiledBackground object. The behavior will take care of setting their positions, because of that, if you try to move them, the behavior will override any change to their positions.

For now, the only way to have props (sprites that move/rotate) with parallax is to place them on their own layer. I've done some tests, however they were inconclusive, if you find a solution to this, please send me a capx at [email protected] , I'll be happy to include it in the addons.

You can have all your elements in one layer, however, you'll have to organize their z-order in the event sheet. (For example: when Obj 1 is created, move it in front of Obj2 and behind Obj3). Having multiple layers is simpler IMO. I'm not aware of any performance issues when using multiple layers in Construct 2. To measure performance, it is always a good practice to do some profiling with and without a feature and see if there is any difference. I've optimized the algorithms as much as possible, however, if you notice some performance drops, please inform me.
ImageImage
B
40
S
13
G
10
Posts: 162
Reputation: 7,571

PreviousNext

Return to Completed Addons

Who is online

Users browsing this forum: fuego96 and 2 guests