Infinite Scroll with tiled background

For questions about using Classic.

Post » Fri Mar 26, 2010 9:35 am

Hi there :)

I wonder, how to do an infinite scroll with a tiled background ? I can do this with a sprite with a for/next loop to random x sprite on the screen. But with a tiled background ?

I've a cool background for space, but I don't know how to make an infinite scroll with. I tried with the warp behaviour but doesn't work : I want it to stay on the screen. With the warp behaviour, the tiled background has to disappear before warping...

thx in advance.
B
1
G
3
Posts: 8
Reputation: 841

Post » Fri Mar 26, 2010 10:34 am

There is a handy "Set image offset" action for the Tiled Background object. Constantly adding to the X offset would make it scroll horizontally for example. Remember that this (like the Tiled Background object in general) only works well with Power-of-two textures.
B
21
S
6
G
10
Posts: 1,024
Reputation: 7,445

Post » Fri Mar 26, 2010 10:46 am

Yes, but we can't retrieve the y offset. To do that, we have to add for ex Y offset + 2 on each loop.

But we can't retrieve the current Y offset.
B
1
G
3
Posts: 8
Reputation: 841

Post » Fri Mar 26, 2010 10:53 am

[quote="Crystal":15n4otyh]Yes, but we can't retrieve the y offset. To do that, we have to add for ex Y offset + 2 on each loop.

But we can't retrieve the current Y offset.[/quote:15n4otyh]

I'm not sure what you exactly mean by that. You don't have to use loops for this either.

Try this for a basic example:
[url:15n4otyh]http://dl.dropbox.com/u/2306601/tbgoff.cap[/url:15n4otyh]

The offset is controlled with the private variables of the Tiled Background object.
Oh, and in case you get an error while trying to open this cap, I'm afraid you'll need a newer version of Construct. In that case just grab 0.99.84.
B
21
S
6
G
10
Posts: 1,024
Reputation: 7,445

Post » Fri Mar 26, 2010 1:20 pm

thx :)
B
1
G
3
Posts: 8
Reputation: 841

Post » Sat Mar 27, 2010 6:01 am

I did an infinite scroll for one of my games, whenever an object was on screen (meaning it was about to run out of room), I set a private variable to the current width of the background then set the width of the background to that variable +500 and set the object out to the end of the background so it could do its job again later.

It was a simple one layout game though and after it had been played, everything was set back to its starting positions. I imagine doing that might be eating up resources though.
B
2
S
2
G
3
Posts: 114
Reputation: 1,553


Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 0 guests