Construct 3 Split Scren - Parallax Background Problem

0 favourites
  • 4 posts
From the Asset Store
Casino? money? who knows? but the target is the same!
  • Hello,

    I'm trying to make a 2 player, split screen platformer to play with my daugther.

    I used Give me a Pixel's tutorial to achieve the split screen effect.

    Everything seems to work fine, except the background layers with different parallax setting.

    I have 6 background layers with different x and y parallax rates.

    I have a canvas object on screen, that covers the right half of the viewport.

    On each frame the I move the objects to canvas position:

    System Set varDX to Player2.X - Player1.X

    System Set varDY to Player2.Y - Player1.Y

    BgBushes Set position to (Self.X - varDX + (ViewportWidth("Canvas") / 2), Self.Y - varDY)

    DrawingCanvas Paste object BgBushes with effects

    And after I paste the object on to canvas, I move the objects back to their positions.

    BgBushes Set position to (Self.X + varDX - (ViewportWidth("Canvas") / 2), Self.Y + varDY)

    As a result, It pastes the background layers to canvas but ignores the parallax values.

    I can't figure out how to calculate the parallax values to move the objects into correct position before pasting them on canvas.

    I've uploaded the project file to dropbox.

    I would appreciate if anyone could help me figure out how to fix this problem.

    Thanks in advance.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Uh oh.. Apparently the dropbox link was wrong.

    Here is the working link to project file.

  • I am aware that parallax layer settings do not work with my split screen effect. I have experimented a little with layer parallax with the split-screen effect, but have gotten nowhere. The only things I can suggest are removing the parallax or making the game real time multiplayer. I'm really sorry I can't help you more. If I get any solutions, I will let you know.

    Give me a Pixel

  • Hi there,

    After a lot of trial and error, I think I made some progress.

    At the end I used CanvasToLayer and LayerToCanvas functions.

    Here is an example line I used to find the position of background sprite on drawing canvas:

    X = CanvasToLayerX("Canvas",LayerToCanvasX("BgBushes", Self.x, Self.y) ,LayerToCanvasY("BgBushes", Self.x, Self.y)) - varDX * (LayerParallaxX("BgBushes") / 100) + (ViewportWidth("Canvas") / 2) Y = CanvasToLayerY("Canvas",LayerToCanvasX("BgBushes", Self.x, Self.y) ,LayerToCanvasY("BgBushes", Self.x, Self.y)) - varDY * (LayerParallaxY("BgBushes") / 100)

    Parallax works on split screen now. But when player 1 moves and jumps, background sprites on Player 2's screen moves a little. This is a bit annoying but I think I can live with that. Afterall this is not a game to be released. I'll try to fix that later.

    Here is the latest project file if anyone is interested.

    I also added zoom. Trying to fine tune it.

    Also I need to fix the split screen bug that happens when Player 1 moves close to edges of layouts.

    I know I can prevent it by blocking player from getting close to edges. But I'think there might be another solution without sacrificing the layout space. Also when zoom is in the equation things get weirder.

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