objective c - Collision detection between two sprites (without a physic body?) iOS -



objective c - Collision detection between two sprites (without a physic body?) iOS -

i having problem getting collision detection work 2 objects. here current code:

_firstposition = cgpointmake(self.frame.size.width * 0.817f, self.frame.size.height * .40f); _squirrelsprite = [skspritenode spritenodewithimagenamed:@"squirrel"]; _squirrelsprite.position = _firstposition; _atfirstposition = yes; [self addchild:_squirrelsprite]; skaction *wait = [skaction waitforduration:3.0]; skaction *createspriteblock = [skaction runblock:^{ skspritenode *lightnut = [skspritenode spritenodewithimagenamed:@"lightnut.png"]; bool heads = arc4random_uniform(100) < 50; lightnut.position = (heads)? cgpointmake(257,600) : cgpointmake(50,600); [self addchild: lightnut]; skaction *movenodeup = [skaction movebyx:0.0 y:-700.0 duration:1.3]; [lightnut runaction: movenodeup]; }]; skaction *waitthenrunblock = [skaction sequence:@[wait,createspriteblock]]; [self runaction:[skaction repeatactionforever:waitthenrunblock]];

i next reply @ first: sprite kit collision detection when set physics body squirrel , nut fall. there way not mess physics (i'm happy how works in app) , create when 1 object touches other game end? there way set radius around sprite? give thanks help or info can provided.

physics bodies required collision detection. if don't want gravity, either set physics world's gravity 0 or turn off affectedbygravity property on each physics body.

ios objective-c sprite-kit

Comments

Popular posts from this blog

php - How to pass multiple values from url -

xslt - DocBook 5 to PDF transform failing with error: "fo:flow" is missing child elements. Required content model: marker* -

database - php search bar when I press submit with nothing in the search bar it shows all the data -