Best way of wrapping starfield?

For questions about using Classic.

Post » Mon Sep 22, 2008 3:41 pm

I can't check right now (ISP still being incompetent; at the library), but I think the ScrollXLeft, ScrollYTop, ScrollXRight, ScrollYBottom expressions give the current viewport, and if you add a layer parameter, it should give the appropriate values for that layer. Eg. on a parallaxed layer "Stars", ScrollXLeft("Stars") should give the X co-ordinate of the left visible edge. If this isn't implemented, then I'll try get it in to the next build. You could then use these values to determine if the stars have left the viewport of the parallaxed layer.
Scirra Founder
B
359
S
214
G
72
Posts: 22,946
Reputation: 178,478

Post » Mon Sep 22, 2008 4:12 pm

I did a test of this, I did when

[code:2ss23ef4]smallstar.X is less than ScrollXLeft("stars_far")
= Set smallstar.x to "smallstar.x + 50
[/code:2ss23ef4]

This results in you moving to the right, then the stars just fly off the screen to the right. So it appears that the ScrollXLeft("Stars") bit is moving to the right.

I couldn't find how to manually do ScrollXLeft("Stars"), i just typed it in and it didn't complain...
B
2
S
2
G
5
Posts: 448
Reputation: 2,546

Post » Thu Sep 25, 2008 4:58 pm

Ash, can you verify that this isn't in this build? Or am I just doing it wrong?
B
2
S
2
G
5
Posts: 448
Reputation: 2,546

Post » Thu Sep 25, 2008 5:48 pm

ScrollXLeft etc. are definitely coded to accept a layer parameter - are you sure it's not working correctly? If you set ScrollXLeft to one text object, and ScrollXLeft("Stars") to another, how do they differ?
Scirra Founder
B
359
S
214
G
72
Posts: 22,946
Reputation: 178,478

Post » Fri Sep 26, 2008 4:26 pm

Ok ash I've uploaded an example. Having the same issues in the example as in my main program.

download/file.php?id=222

Basically, the code is meant to move the star 50 pixels to the right when it hits the left edge of the viewport. (of course in the game i would not do 50 pixels, i would just set it to the rightside of the viewport).

Maybe i'm just using it wrong... Can you take a look at it Ash?
B
2
S
2
G
5
Posts: 448
Reputation: 2,546

Previous

Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 0 guests