[Behavior] Parallax background for side-scrolling games

Post your completed addons to share with the community

Post » Wed Feb 14, 2018 6:35 pm

AnD4D wrote:@Zed2100 This is a very interesting plugin, however it doesn't appear to be working the way I expected. Is this only for horizontal items?

To test it out, I placed a sprite out, scattered randomly across the layout. Upon running it, however, the plugin pulls all the sprites back to the exact same Y position, meaning they're now all in a line.

Say for example I wanted to create a starmap, with objects all over the place. With this plugin, I can't get it to refrain from setting the Y axis to the same position.

Could you confirm whether or not I'm doing something wrong? Or is this by design?


The behavior takes full control of the Y position of your sprites, it's designed for side-scrolling games (platformers, runners, side scrolling shooters) where backgrounds are supposed to be "grounded", ie their Y position will be computed starting from the bottom of the layout.

I don't know the specifics of your implementation, but I guess you're better off handling the placement of the objects through the event sheet, or by using a parallaxed layer.
ImageImage
B
46
S
14
G
10
Posts: 195
Reputation: 7,897

Post » Thu Feb 15, 2018 2:14 am

Agreed. I found a single event solution for this problem. For some reason I'd never thought about using division for parallax before.
B
98
S
20
G
8
Posts: 1,066
Reputation: 12,758

Post » Thu Feb 15, 2018 12:57 pm

AnD4D wrote:Agreed. I found a single event solution for this problem. For some reason I'd never thought about using division for parallax before.


Glad you found a solution.

Implementing a custom parallax effect can be tricky. In case you wish to further improve your solution, I'm selling a template version of this plugin, I believe it's a good example of implementing a custom parallax effect through the event sheet.
ImageImage
B
46
S
14
G
10
Posts: 195
Reputation: 7,897

Post » Thu Feb 15, 2018 6:43 pm

It's alright! I've got it perfected now. It'll work in all directions and can wrap perfectly, without lining everything up, with just a few events. I never knew how parallax really worked prior to doing this, so I'm glad to have cracked it.
B
98
S
20
G
8
Posts: 1,066
Reputation: 12,758

Post » Mon Apr 23, 2018 12:10 pm

AnD4D wrote:It's alright! I've got it perfected now. It'll work in all directions and can wrap perfectly, without lining everything up, with just a few events. I never knew how parallax really worked prior to doing this, so I'm glad to have cracked it.


I agree that it's fairly easy to implement a simple parallax effect for 1 or 2 backgrounds, the problem becomes much more complex when:
  • When you need all your backgrounds to look good no matter the zoom level (ie layout scale).
  • When you have multiple backgrounds, especially on big projects. You don't want to create hundreds of layers for that. And you don't want to clutter your event sheets.
  • When you want some of your backgrounds to be animated, so they need to wrap around the screen by creating multiple instances of the object, or you want some of your backgrounds to be static to save some performance, so they need to wrap around the screen by stretching a TiledBackground object.
  • @norman74 When you want some backgrounds to not wrap around the screen, like the sun, a house in the distance, a planet in a space game.
  • When you want your background to wrap around screen in both the horizontal and vertical directions for top-down space games, or top-down shooters.
  • When you want your background to have a custom parallax anchor, for platformers, the anchor is usually at the bottom of the layout, so all the mountains in the background will be "grounded", but for top down shooters, you need the anchor to be at the object's initial position.

@AnD4D I get a similar comment on my Health and FSM addon. Some people are like: "Health is so easy to implement, just add a "hp" attribute and you're done, why should I use your addon?". Well, what if you want a health regeneration system, what if you want a nice condition that triggers when an enemy dies, what if you want your spaceship to be invincible for a few seconds? A simple thing can become ridiculously complex. And when working on a bigger project, your worst enemy is complexity. If you can reduce it, you dramatically increase your chances of finishing the game.

Anyway, enough rambling :D

I'm happy to announce that all the above features have been implemented in the next 1.2.0 update, along with: A Construct 3 version, cool new demos including a top down scroller, a vertical shooter, and an updated version of the current demos.

I'll release the update after finishing some QA tests to make sure everything works perfectly, I'm also finishing the demos and updating the manual. I expect to be done some time this week, so keep an eye on the forum.

If you have purchased this addon on the Scirra store, thank you for your support, you're awesome ;)
ImageImage
B
46
S
14
G
10
Posts: 195
Reputation: 7,897

Post » Mon Apr 23, 2018 1:13 pm

@Zed2100

Good job! Will be this update available on Construct 2?
B
40
S
15
G
2
Posts: 205
Reputation: 4,178

Post » Mon Apr 23, 2018 1:16 pm

norman74 wrote:@Zed2100

Good job! Will be this update available on Construct 2?


Of course, yes !
ImageImage
B
46
S
14
G
10
Posts: 195
Reputation: 7,897

Previous

Return to Completed Addons

Who is online

Users browsing this forum: GoldyPMU and 0 guests