Note that there are some explanatory texts on larger screens.

plurals
  1. PONo Co-Ordination Between Layers while Bakground Moves with Different Speed
    primarykey
    data
    text
    <p>I am developing an iPhone Game using COCOS2d Framework and Objective-C (in Landscape mode/view). </p> <p>For the game, I am using a Background which has Four Layers ('Sky' on Top, 'Mountain' below sky, 'Hill' below Mountain and 'Foreground' extreme below). Here I need to move each Layer of the Background with a different speed like 'Sky' should move slower than Mountain, 'Mountain' should move slower than Hill and 'Hill' should move slower than Foreground.</p> <p>While I am moving each Layer with a different speed, the game experiences a BREAK-UP BETWEEN CO-ORDINATION OF the LAYERS.</p> <p>I tried resolving this with logic like: increasing image/Layer(width) size according to it's speed so that each layer should end and start running again with co-ordination. Couldn't get it to work.</p> <p>This is my code for Moving the Background:</p> <pre><code> -(void) backgroundmoving { if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) { //return kDevice_iPad; // Code for Each Layer's Moving Speed FOR iPad bk_f -=1.0; bk_f1 -=1.4; bk_f2 -=1.8; bk_f3 -=2.2; } else { // Code for Each Layer's Moving Speed FOR iPhone bk_f -=0.2; bk_f1 -=0.4; bk_f2 -=0.6; bk_f3 -=0.8; } if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) { //return kDevice_iPad; if (bk_f &lt;= -920*1.1) {bk_f=0;} if (bk_f1 &lt;= -920*1.1) {bk_f1=0;} if (bk_f2 &lt;= -920*1.1) {bk_f2=0;} if (bk_f3 &lt;= -920*1.1) {bk_f3=0;} if (bk_f4 &lt;= +920*1.1) {bk_f4=0;} } else { if (bk_f &lt;= -480*2) {bk_f=0;} if (bk_f1 &lt;= -480*2) {bk_f1=0;} if (bk_f2 &lt;= -480*2) {bk_f2=0;} if (bk_f3 &lt;= -480*2) {bk_f3=0;} if (bk_f4 &lt;= +480*2) {bk_f4=0;} } _level_bkgrnd.position = ccp(bk_f, 0); _level_bkgrnd1.position = ccp(bk_f1, 0); _level_bkgrnd2.position = ccp(bk_f2, 0); _level_bkgrnd3.position = ccp(bk_f3, 0); } </code></pre> <p>Above code gives me the background issue. Am providing screenshot links for reference:</p> <p>1) <a href="http://screencast.com/t/seUjXClz">http://screencast.com/t/seUjXClz</a></p> <p>2) <a href="http://screencast.com/t/8tHq2KYnnMa">http://screencast.com/t/8tHq2KYnnMa</a></p> <p>Any help pointing me in the right direction would be greatly appreciated.</p> <p>Thanks In Advance :)</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload