Shah
Shah

Reputation: 5020

how to add a repeating background in cocos2d

I am new in iphone and as well in cocos2d

I have some queries about a game i am working on it.

Actually i have a background with some trees and bushes.and i have an object which keeps on moving and my background of trees and bushes is static at the back. I want the application to repeat the background and it give me a look that my object is moving forward.

Can anybody Guide me please.

I also want to implement speed so also guide me that how can i change the speed of background repetition. so that it gives a look that my object is slow or fast

Thanks

waiting for your positive response.
Regards
sHaH

Upvotes: 1

Views: 3827

Answers (1)

Felix
Felix

Reputation: 35384

Work through this excellent tutorial:

http://www.raywenderlich.com/3857/how-to-create-dynamic-textures-with-ccrendertexture

It'll surely help you.

The section "Repeating Backgrounds" explains how to make a texture repeat and animate it.

In order to change the speed you can make PIXELS_PER_SECOND a dynamic variable.

Upvotes: 1

Related Questions