cocos2d iphone - Box2D How to transfer remaining impulse from one body to another -


after applying box2d body:

    b2vec2 force = b2vec2(velocity.x/ptm_ratio, velocity.y/ptm_ratio);     _body->applylinearimpulse(force,_body->getposition()); 

i'm trying in many game (like doodle jump) stop moving hero body once reaches distance top of screen , start scrolling stage feel hero still climbing higher. need move hero in first place , move stage.

how can achieved correctly ? idea?

thats quite odd thinking solve problem. never stop character or of environment objects. let them behave intended box2d. have added 1 root node of sort, environment , character. create sort of "camera controller" , give characters ccsprite, or wrapping objects if have one, target. in update function call each frame change root nodes position in way centres screen on character. can implement follow delays, smooth scrolling , other nice features need them.

unfortunately don't use cocos2d @ all, can't give sample code. given solution work cocos2d not far of engine use @ work place.


Comments

Popular posts from this blog

css - Which browser returns the correct result for getBoundingClientRect of an SVG element? -

gcc - Calling fftR4() in c from assembly -

Function that returns a formatted array in VBA -