How do I fix my scrolling background

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

    I'm new to construct and I really like it. I'm trying to do a small test game where a horse has to jump over stones.

    To fake the running of the horse I have 3 scrolling backgrounds.

    I added each background twice (one time in the main scene and once out of the scene) both parts are scrolling with the same speed.

    If one is out of the screen (Checking with IsOutOfLayout) it's position is set to the right out of screen and it can scroll again.

    It's working very well except the fact that there is a small gap between the first and the second background (only if it was reset!) and this gap is getting bigger the faster the background scrolls.

    I tried several things like setting the background to windowWidth - 1 pixel or windowWidth - speed of background or reset the background if it's x position is on 1 - backgroundwidth etc. but nothing worked.

    Any one has an idea?

    You can see the problem here:

    fs5.directupload.net/images/151201/alouvgwt.jpg

    If you want to have a look into the project, download it here:

    file-upload.net/download-11088144/Horsegame.zip.html

    Thank you all

    Btw:

    If you have a look into the project and you see other things which could be done better, feel free to tell me. As said I'm new to it (started yesterday ).

    P.S. Im sorry I'm not allowed to post the urls correctly

  • Why are you using C2 version 206? This is a very old version from May.

    I would advise updating to at least the latest stable version, just in case there are bugs affecting you that may have already been fixed.

  • Whoops you're right my version is freaking old!

    Downloaded it a long time ago but only found time now.

    Was so excited to finally start that I totally forgot to check for new versions.

    Thanks!

    But I don't think that will fix the problem.

    Edot: Updated to newest version and as thought, doesn't help or change anything. Anyway thanks for the hint

  • you should move relative to the one still within viewport..

  • you should move relative to the one still within viewport..

    I'm sorry I don't understand what exactly you're meaning.

    Would it be possible to go into further details.

    Thank you

  • You want it to fit nicely to the last one, so you should set the position based on boundingboxright of the last one..

  • Ok I see what the idea behind it is.

    But how can I force it to jump to the bounding box right of the second background? I tried and it's always jumping to it's own right.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Instead of re-inventing the wheel, why not do it this way:

    https://dl.dropboxusercontent.com/u/485 ... croll.capx

  • Okay very cool it's working now.

    Thank you very much LittleStain

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