Example: infinant tiled background

Post your own tutorials, guides and demos.

Post » Mon Aug 10, 2009 1:33 am

Yea, i know, I'm new to the forums but I've been lurking around for a month or so. But i noticed there is a lack of example of how to setup an infinite background so i decided to make one.

[url:1mwfwszm]http://www.box.net/shared/6zvpp2e904[/url:1mwfwszm]

Although i have a feeling that I'm missing an easier way of doing this, but on the bright side it shows how to expand adjustable background scrolling to outside the normal layer "window"
B
1
G
3
Posts: 1
Reputation: 827

Post » Mon Aug 10, 2009 2:10 am

Nice example!
B
8
S
3
G
7
Posts: 835
Reputation: 5,313

Post » Mon Aug 10, 2009 1:18 pm

There is a way to do it with a single event.

[list:2bejle25][*:2bejle25]First, you need a tiled background with texture in size of power of two (16x16, 32x32, 256x256 ex.)[/*:m:2bejle25]
[*:2bejle25]Put the tiled background on a layer that has 0% X and Y scroll rates. Make it cover the whole display.[/*:m:2bejle25]
[*:2bejle25]Make an Always event like this:
[code:2bejle25]+Always
>TiledBackground: Set offset to ScrollX, ScrollY[/code:2bejle25]
(You can add a factor like ScrollX*0.5, ScrollY*0.5 to make it scroll more slowly)[/*:m:2bejle25]
[*:2bejle25]You'll also need to scroll the display, just add this to the Always event:
[code:2bejle25]> System Scroll to X ScrollX+(MouseX-ScrollX)*TimeDelta
> System Scroll to Y ScrollY+(MouseY-ScrollY)*TimeDelta
[/code:2bejle25]
(This will always scroll the display smoothly toward mouse coordinates)[/*:m:2bejle25]
[*:2bejle25]Make sure you have Unbounded scrolling ticked in Layout Properties[/*:m:2bejle25][/list:u:2bejle25]
Voila!
B
62
S
21
G
12
Posts: 1,910
Reputation: 13,155


Return to Your tutorials & example files

Who is online

Users browsing this forum: No registered users and 2 guests