Oleg Korban
Oleg Korban

Reputation: 269

Cocos2D. Endless background in all directions

I have one texture that i need to set as a background. Scrolling should be in left, right and bottom directions. I have tried to change texture coords, to swap row of 3 textures down and then swap horizontal textures... epic failure. Does anyone know how to make a background from the same tiled texture in all directions?

Upvotes: 2

Views: 1218

Answers (1)

pabloruiz55
pabloruiz55

Reputation: 1306

You have many approaches to this, depending your needs:

If you are looking for a huge scrolling background (although not infinite) you could use CCBigImage extension.

If you want infinite scrolling backgrounds, what @Skullz suggested is ok too. You can easily modify that code to support scrolling in both axis, instead of repositioning 2 images, you would reposition 4 of them.

Using that method, plus adding some random items to add some variation should be enough. You can also use CCParallaxNode for a better effect.

Upvotes: 1

Related Questions