Parallax causing problems

Get help using Construct 2

Post » Thu Jul 20, 2017 3:54 am

I'm making a platformer game. I use parallax 0 for a basic HUD, and Parallax 5,5 for a pretty large but very simple background.

I tried to add a second, closer background, and when I changed it's parallax to 50,50 it caused major lag issues along with enemies falling through floors and their health bars flying all over the place.

Also, for some reason, if I move this layer to the top of the layers, there is no problem.

My layout is pretty big at 6000/2000 pixels and I have a giant sprite as the background that's prallax is 5,5. I thought it had something to do with that but if I turn off the parallax/delete the backrgound sprite i get the same problem.

Are there any known issues with parallax causing problems? I checked google but couldnt find anything.

Thanks for any help
B
9
S
3
Posts: 52
Reputation: 729

Post » Thu Jul 20, 2017 7:48 am

Parallax is a pretty standard/stable feature and hasn't been amended for a long time. If there where any issues, they would have been fixed a long time ago.

Probably easier to work out your issues if you post your .capx so we can see the problem for ourselves.
If your vision so exceeds your ability, then look to something closer.
Moderator
B
136
S
31
G
86
Posts: 5,482
Reputation: 59,750

Post » Thu Jul 20, 2017 12:25 pm

Hey thanks for the response.

I feel a little weird posting the capx because of how much progress I've made on the game.

I was hoping there were some known issues.

I think I'll try some more testing and if I can't find anything I'll have to post the capx.

Thanks again.
B
9
S
3
Posts: 52
Reputation: 729

Post » Thu Jul 20, 2017 11:10 pm

You probably have enemies, their health bars .. and the platforms on layers with different parallax property's.

Enemies and their health bars on layers with different parallax property's can be done (calculated) with ...

CanvasToLayerX(layer, x, y)
CanvasToLayerY(layer, x, y)
Calculate the layout co-ordinates underneath a position in canvas co-ordinates for a given layer.

LayerToCanvasX(layer, x, y)
LayerToCanvasY(layer, x, y)
Calculate the canvas co-ordinates above a position in layout co-ordinates for a given layer.

Solid platforms and the characters, with a platform behaviour, that are supposed to interact with those platforms can not ever be on layers with different parallax.

We do not ask you to share your game, we ask you to share the problem. A problem can usually be isolated in a simplified project. Like this:
https://www.dropbox.com/s/u6wbwc2nul7ig ... .capx?dl=0

Besides the act of sharing, you learn a LOT by isolating the problem in a simple .capx. More then you expect at this point.
B
33
S
18
G
28
Posts: 2,493
Reputation: 20,950

Post » Thu Jul 20, 2017 11:25 pm

Oh an let me explain what happens.

Take two sheets of paper. Match them neatly. Slam a small hole trough both. Now slide (parallax) the sheets of paper. The holes will no longer overlap. However, the holes on each sheet of paper are not shifted.
B
33
S
18
G
28
Posts: 2,493
Reputation: 20,950

Post » Fri Jul 21, 2017 4:16 am

Hi 99Instances. Thanks for the response.

Currently, my enemies and their health bars share the same layer, and the platforms/floors are on a layer below them.

Both of these layers are at parallax 100,100.

The only layers that have different parallax values are the one with the HUD (0,0), and the background (5,5)

I've been doing some testing, and it seems as though for some reason, if I move this new layer below the other layers, that seems to be causing problems, even if I don't alter it's parallax values.

For example, if I move this layer down, objects that are being created on another layer are appearing BEHIND objects when they should be appearing in front.

The problem seems to be coming from moving the layer down below other layers?

I have been trying to recreate this problem in a new project but so far no luck.

Anybody know what might be happening?

Thanks
B
9
S
3
Posts: 52
Reputation: 729

Post » Fri Jul 21, 2017 5:27 am

Oh wait I think I see.

I was looking at the NAME of the layers, which I never changed from "Layer 1" and so on. So by moving the layer, it affects everything coded to that layer's actual number, not the title.

I understand now. I can't check at this time but I'm sure that's what the problem is.

Thanks for the help everyone. I'll come back if I'm wrong but this surely must be the problem.
B
9
S
3
Posts: 52
Reputation: 729

Post » Mon Jul 24, 2017 6:49 am

Maako wrote:Oh wait I think I see.

I was looking at the NAME of the layers, which I never changed from "Layer 1" and so on. So by moving the layer, it affects everything coded to that layer's actual number, not the title.

I understand now. I can't check at this time but I'm sure that's what the problem is.

Thanks for the help everyone. I'll come back if I'm wrong but this surely must be the problem.


You can use the layer name is the identifier instead of the layer number. You just have to use quotation marks around the name.

Create player.sprite on Layer 0
-or-
Create player.sprite on "MyLayer"

~Sol
Tired of crappy file hosts that are crappy? Get DROPBOX - https://db.tt/uwjysXJF
Moderator
B
84
S
34
G
40
Posts: 3,032
Reputation: 30,499


Return to How do I....?

Who is online

Users browsing this forum: Lordshiva1948 and 6 guests