Parallax causing problems

0 favourites
  • 8 posts
From the Asset Store
Set of 10 Parallax Background to make pixel art game.
  • 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

  • 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.

  • 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.

  • 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.

  • 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.

  • 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

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • 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.

  • 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

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