Automatic Scrolling Layers

New releases and general discussions.

Post » Mon May 18, 2009 10:15 pm

Hey,

One feature it seems Construct is missing right now is the ability to set layers to automatically scroll. I'm developing a scrolling space shooter game, where all the action happens in one still frame, while the background scrolls to give the impression you are flying forwards. There currently seems to be no way to let layers to automatically scroll while the player sprite stays still.

I've got around this by giving backdrops ball movements and using the wrap behaviour, but as I'm loading in large chunks of backdrop for scrolling, this eats up at lot of VRAM. A feature to set layers to automatically scroll would be really useful!

Many thanks, Tom
B
2
S
1
G
5
Posts: 50
Reputation: 1,500

Post » Mon May 18, 2009 10:21 pm

Tiled Background objects can scroll their contents using the "Set Image Offset" action. You can make a scrolling starfield pretty easily with that. You can even make a starfield with depth by layering different Tiled BGs and setting their offsets at different rates.

You have to make sure that your textures are a power of 2 to scroll the offset in a Tiled BG though.
Moderator
B
5
S
2
G
6
Posts: 4,348
Reputation: 10,971

Post » Mon May 18, 2009 10:22 pm

How about always scrolling in some direction but setting the gameplay layer scroll rates to 0 so it doesnt go anywhere?
Scirra Founder
B
359
S
214
G
72
Posts: 22,952
Reputation: 178,630

Post » Tue May 19, 2009 5:11 pm

Concerning 'Set Image Offset', there doesn't seem to be a way to compare the current offset in the event editor, so I can't make it continuously scroll. Ashley's method works, but there doesn't seem to be any difference in memory usage. I guess this would be the case even in there was an 'infinate scrolling' option. It would still be a nice option to have in the settings though!

Thanks for the help guys!

- Tom
B
2
S
1
G
5
Posts: 50
Reputation: 1,500

Post » Tue May 19, 2009 6:34 pm

[quote="chaosmaster":21dn4u0v]Concerning 'Set Image Offset', there doesn't seem to be a way to compare the current offset in the event editor, so I can't make it continuously scroll.[/quote:21dn4u0v]

You're not trying hard enough ;). There is always a way.

http://dl.getdropbox.com/u/529356/starscroll.cap

You give the tiles a private variable, add to it over time, and set the offset to the value of the variable. It only takes one event.

Hope this helps :)
Moderator
B
5
S
2
G
6
Posts: 4,348
Reputation: 10,971

Post » Wed May 20, 2009 2:31 am

Of course! I could even use the built in 'timer' function to continously scroll it. Quite simple, can't believe I didn't think of that. Thanks a lot!

- Tom
B
2
S
1
G
5
Posts: 50
Reputation: 1,500


Return to Construct Classic Discussion

Who is online

Users browsing this forum: No registered users and 0 guests