Moving a cocos2d-iphone+box2d boy in one direction -


please can advice me on this.

i have cocos2d-iphone +box2d body wish move in 1 direction(movement left right of iphone screen) using accelerometer controls , parallax scrolling. please how do @ moment body moves both left , right once device tilted. not want use forces or impulse since i not enabling touch controls. accelerometer code :

- (void)accelerometer:(uiaccelerometer *)accelerometer didaccelerate:(uiacceleration   *)acceleration {   float32 accelerationfraction = acceleration.y * 6; if (accelerationfraction < -1) {     accelerationfraction = -1; } else if (accelerationfraction > 1) {   accelerationfraction = 1; b2vec2 gravity(-acceleration.y *10, acceleration.x *10);  world->setgravity( gravity ); } 

thanks in advance .

you should use mousejoints. @ tutorial. there explains trying accomplish.


Comments

Popular posts from this blog

php - How can I edit my code to echo the data of child's element where my search term was found in, in XMLReader? -

java - Why is BlockingQueue.take() not releasing the thread? -

jQuery Ajax Render Fragments OR Whole Page -