Bottom-top infinite scroller

0 favourites
  • 7 posts
From the Asset Store
Get Ready for the New Wave of "Bottom Screen" Games!
  • Hi, I'm new here!

    I'm trying to make a running game (like Robot Unicorn Attack, Cannabalt etc.), but from bottom to top:

    I have 2 BG pics:

    *a forest

    *a tree trunk

    and the character on it.

    The character shall move automatically upwards (bullet movement?), and the 2 BG pics shall repeat infinitely in the y direction.

    I can't seem to get that done.

    I searched the forum here, but nothing really nailed it - I'm not a native English speaker, so maybe I have misunderstood some things.

    I have done the top down standard tutorial.

    Problems:

    1. I want the screen scrolled to my character - but not at the center, but at the bottom of the screen where I placed my character initially.

    2. How do I get my BG pics to repeat in Y axis?

    Maybe we can start just with this...

    Bye and thanks in advance!

  • 1. get rid of the scroll-to behavior, and make an event:

    every tick:

    --> scroll to X: player.X

    --> scroll to Y: player.Y + somenumber

    2. You will have problems with an infinite layout. For something like this, you should have the background moving down, and the player standing still.

    As for how this is done, have a look at the FAQ, specifically the scrolling/camera section.

  • Okay, I got it!

    The player is standing still now, and the background is scrolling via the method posted by Kyatric in this thread: scirra.com/forum/scrolling-tiled-background-c2_topic44823_page1.html .

    However, I still have that ominous "gap" between my tiles that the author of that thread spoke of as well.

    Casting the "dt" to an int didn't help either.

    e.g.

    event => TiledBackground.X to TiledBackground.X - int(60*dt)

    And the gap issue wasn't solved in that other thread. Does anybody has a hint? Here is my capx:

    slurp.capx

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Instead of setting y to 0, set it to 'self.y - self.Width * 2'.

  • Okay, that did it. Thank you very much!

    ...but why? In my example this would be

    self.y = 1600 - 800*2

    which is... nearly... identical to 0 :p ! Why does that make a difference?

  • Setting y to 0 works if y is exactly 1600 when you change it. But if the background has gone a little bit past 1600 (which it can) then you get the gap.

  • Okay, I get it!

    Thanks for alle the help! It works now and I'm about to implement more features, a local highscore and so on...!

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