How do I visually offset layers of different parallax values

Get help using Construct 2

Post » Sun Mar 01, 2015 1:58 am

I thought I'd done this once and knew how to make it work. Unfortunately I think I'm missing something about this problem.

In the example, I have 2 layers.

Layer 1 has a parallax of 100
Layer 0 has a parallax of 50

Each layer has a simple sprite placed at x:500 and y:500.

What I'm trying to do is (on layout start) offset the position of sprite_50 so that it appears to line up visually with sprite_100 at the start of the layout.

Ultimately, I intend to offset numerous objects on various background layers each with different parallax values. I'm not sure, but I think what I'm trying to do involves parallax origin. I've done some searching but wasn't able to find anything that helped.
You do not have the required permissions to view the files attached to this post.
B
17
S
2
Posts: 66
Reputation: 1,382

Post » Sun Mar 01, 2015 3:51 am

Parallaxing layers can be very frustrating with the current workflow. Since there isn't a "look trough camera" option and no 2.5 z depth, the only thing you can do in order to set up your scene is the following;

1) In the editor, make sure that the zoom level is at 100% (this option can be found on the view tab).

2) Then, click on the layers in order to access their properties and on the editor properties field set "Parallax in editor" to Yes.

After that you should be able to align your sprites in the editor and their relative positions should be the same upon run-time.
composer - multimedia artist
www.eli0s.com/en/
B
59
S
24
G
4
Posts: 1,137
Reputation: 9,136

Post » Sun Mar 01, 2015 3:55 am

Maybe there is a fancy equation that will allow you to offset individual objects by an amount based off the parallax values of the layer and the window size. I would be interested in seeing it done.

It might not help much but I have always set up mine in the editor.
You do not have the required permissions to view the files attached to this post.
ImageImage
B
89
S
18
G
6
Posts: 1,049
Reputation: 11,165

Post » Sun Mar 01, 2015 4:10 am

@eli0s Normally I would do that, the problem is that I'm generating my background objects randomly at the start of the layout.

@GenkiGenga Yeah, the "fancy equation" idea was what I originally thought of.

My camera starts out in the middle of my layout, but my layout is somewhat large 10k and if the camera is scrolled to 5000, 5000 many of the background layers are totally missing.
This is just a visual effect I'm going for. I won't need these background objects to do anything except look correct when my camera starts out in the center of the layout.

I'll keep working on it. I have a strong feeling that I'm just being stupid about this and missing something simple.
B
17
S
2
Posts: 66
Reputation: 1,382

Post » Sun Mar 01, 2015 4:34 am

I think I've come across something of a fix, though sadly I think this will probably only help me and not others with similar problems relating to the fixed parallax origin issue.

What I've been trying to do is generate an asteroid field in the background of my game.

So what I do is basically create a few thousand objects at random(layoutsize). Then I scaled each object based on the parallax value of the layer it was on. This caused more "distant" asteroids to scale down and look appropriate far away.

After searching through other older threads about similar issues I came across https://www.scirra.com/forum/top-down-fake-depth-3d-effect_t81087.
By using buddy40's method of setting the background layers to a different scale, I've achieved the parallax effect that I wanted, while mostly maintaining the correct visual positions of asteroids.

This does mean that I might need to use a wider range of coordinates for my background layers to compensate, but otherwise the problem (for me) is largely solved.
B
17
S
2
Posts: 66
Reputation: 1,382

Post » Sat May 21, 2016 7:25 pm

Hi @WarpedOldMan Any chance you have a copy of @buddy40 's capx? Thanks!
B
15
S
7
G
34
Posts: 55
Reputation: 18,478

Post » Sat May 21, 2016 8:00 pm

I had a look around, but I can't find it anymore, sorry. Are you having a similar issue? I might remember some of what I was doing at the time, and how I (sort of) fixed it.
B
17
S
2
Posts: 66
Reputation: 1,382

Post » Sat May 21, 2016 8:37 pm

Yes, I am working on an infinite scroller and I have this sky layer with parallax(80,100) that I can't seem to nail down to a separate ground layer(100,100). I was hoping offsetting it would solve it.
B
15
S
7
G
34
Posts: 55
Reputation: 18,478

Post » Sat May 21, 2016 8:45 pm

Could you post a screenshot or video demonstrating what is happening? Also maybe show us a screenshot of the event sheet or even post the project.
B
17
S
2
Posts: 66
Reputation: 1,382

Post » Sun May 22, 2016 7:54 am

@WarpedOldMan
Here's a link to my capx. https://goo.gl/wfBqNu I guess what I am really looking for, is a better way to loop my tiledsky object (perhaps by offsetting) so it loops properly when I finally move it to the Sky Layer.
B
15
S
7
G
34
Posts: 55
Reputation: 18,478

Next

Return to How do I....?

Who is online

Users browsing this forum: dannykln, hyem, sebastiangohhy, Yahoo [Bot] and 9 guests