Scrolling Tiled Background.

Get help using Construct 2

Post » Tue Aug 23, 2016 2:33 pm

I'm making a game where you drill into the earth and I'm using a scrolling tiled background that breaks away as you drill through it. My problem is that when I increase the scrolling speed (to have the effect that you're drilling faster) the newly spawned tiled backgrounds start to show gaps between them.
B
16
S
1
Posts: 26
Reputation: 644

Post » Tue Aug 23, 2016 5:27 pm

If your background is actually a Tiled Background Object, I recommend using just one tiled texture and resetting it instead of spawning one object after the other.

-IF-
[Tiled Background] Y is less or equal to Self.Height

THEN
[Tiled Background] Set Y to Self.Y - Self.Height / 2




Just set the height of your object match your LayoutHeight * 2

(I am assuming you are scrolling vertically. Otherwise, set Y and Height to X and Width).


For reference, check the Auto Runner Template that comes with Construct 2, there is a horizontally auto scrolling background in there.

Let me know if this help :-)
B
5
S
1
Posts: 33
Reputation: 462

Post » Tue Aug 23, 2016 10:40 pm

B
56
S
15
G
13
Posts: 826
Reputation: 17,645

Post » Wed Aug 24, 2016 12:31 am

I had the same question once and R0J0Hound got me a really good one-line code for this.

The code is:
Every tick -> Set tiledbackground Y position to (self.Y+10*dt)%256-256

Just switch the 256 for the height of the image. If you want to change the speed, just switch the 10 for something else.

Here's an example:
https://dl.dropboxusercontent.com/u/238 ... croll.capx
B
123
S
43
G
41
Posts: 846
Reputation: 28,204


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 26 guests