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
Post a Comment