I'm not sure if this is of any help, but when I had the same issue and I
looked at ScrollableLayer, it seemed like I had to create a very, very
large image. So I decided to use a trick instead:

background.do(Repeat(MoveBy((-500, 0), (500/SCROLLING_SPEED)) +
MoveBy((500, 0), 0)))

What this does is it moves the image visibly to the left by 500 pixels in a
certain amount of time (depending on the scrolling speed (set to 0-100)),
and then quickly moves it back to the right by 500 pixels. This last
movement isn't visible to the human eye if your image's pattern repeats
every 500 pixels, but it "resets" the image position so you don't need a
huge image for your level. The same image just moves left and right
continuously.

I'm not saying this is better, but it is just one line of code so might
help you out 😅

Cheers,

Ivo

On Sat, Jan 23, 2021 at 2:36 PM Toni Roca <[email protected]> wrote:

> I making a space game, and i need a infinite background loop.
> And the question is , i need use a tiled map or a ScrollableLayer?
>
> Thanks all.
>
> --
> You received this message because you are subscribed to the Google Groups
> "cocos2d discuss" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/cocos-discuss/1238b3eb-f6dc-48d7-a75e-9b234415142cn%40googlegroups.com
> <https://groups.google.com/d/msgid/cocos-discuss/1238b3eb-f6dc-48d7-a75e-9b234415142cn%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"cocos2d discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/cocos-discuss/CAPOiXu6Uw%3DuupNEzTgcM%3Dj-D7rC%2BH4VNiwwojLVyb%3D7DPYd%3DJg%40mail.gmail.com.

Reply via email to