ios - Applying forces on an object -


if i've understood right, when "applyforce" pushing object in vector direction , power long applyforce applied. when try apply force on body in 'touchesbegan' (because want pushed long touch screen) little push makes jump few pixels , falls down result of physicsworld settings. (i want force stop pushing when 'touchesended') ideas anybody? thanks

(xcode 5, spritekit)

touchesbegan: fire once when screen touched.

to continue long finger touching screen can this:

create bool ivar

@implementation myscene {     bool thefingertouches; } 

next register touch know how

- (void)touchesbegan:(nsset *)touches withevent:(uievent *)event {     thefingertouches = true; } 

make sure register when touch no longer present

-(void)touchesended:(nsset *)touches withevent:(uievent *)event {     thefingertouches = false; } 

lastly use update: method need depending on bool

-(void)update:(cftimeinterval)currenttime {     if(thefingertouches == true)     {         // code here     } } 

Comments

Popular posts from this blog

javascript - Jquery show_hide, what to add in order to make the page scroll to the bottom of the hidden field once button is clicked -

javascript - Highcharts multi-color line -

javascript - Enter key does not work in search box -