How do I make a flawless scrolling background?

0 favourites
  • 4 posts
From the Asset Store
Classic style beat'em up template. Punch & Kick foes across the screen.
  • Hello,

    I have tried different methods to make a background scroll and wrap around flawlessly.

    One way is using 2 instance and pinning/hierarchy them together. But when running the game, they look like one is dragging the other.

    I tried using Tiled Background and moving it around + resizing it at the same time, but it was a bit complex.

    The approach I used was using 2 instances with Bullet behavior with the same speed. It mostly worked, but there are noticeable tears where they meet. It is not noticeable when the bullet moves at high speed, but it is there.

    All approaches use the Wrap behavior. But the problem with it is that it needs the whole object to go outside of layout before it wraps around. Is there a way to make the object "partially" wrap? i.e. the parts outside of layout wrap around.

    I don't know if I need to change some options in the Layer/Project properties for this to work.

    Thank you.

  • I think the most straightforward and resource friendly way is a tiled background. No need to change it's size, just make it double the size of the viewport and move it by a multiple of it's source image's width when necessary.

    No need to bother with the wrap behavior either.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Not sure exactly what you mean

    Put a TBG on a 0, 0 parallax layer and change it's offsetX should work

  • Thanks a lot oosyrag and NoahBoy!

    For my case, I used a TBG and this code:

    Every tick :: Set TBG.ImageOffsetY = TiledBackground.ImageOffsetY + Speed * dt

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