ios7 - How can I implement a SKPhysicsBody object in another SKPhysicsBody object? -


The view is: A player and a box are in the player box when I swipe right on the screen, the player is right Moves on When he reaches the right edge of the box, he will push the box to the right.

So I let Skeand design I

  Sijiarti box = Sijiaraktmek (110, 270, 100, 100); SKShapeNode * sizeNode = [[SKShapeNode alloc] init]; ShapeNode.path = [UIBezierPath bezierPathWithRect: box] .CGPath; ShapeNode.physicsBody = [SKFFixics body body descriptionPolygonpath: shapeNode.path]; ShapeNode.physicsBody.dynamic = no; ShapeNode.physicsBody.categoryBitMask = kbox; ShapeNode.physicsBody.collisionBitMask = 1; ShapeNode.physicsBody.contactTestBitMask = kplayer; [Self linking child: shape node]; SKSpriteNode * Player = [SKSpriteNode spriteNodeWithColor: [UIColor whiteColor] Size: CGSizeMake (10, 30)]; Player.fixesbode = [sffixics body bodywriting: size: player size]; Player physicsBody.categorishmask = kplayer; player.physicsBody.collisionBitMask = 1; Player.physicsBody.contactTestBitMask = kbox; Player.position = CP pointmake (auto size.width / 2, self size .ight / 2); [Self cohesive: player];   

The initial code above was not working, the shape can not collide with a player. How can I apply an SKFiCix body object to any other SKPx body object? And how can I apply my thoughts? Thank you very much!

You can add child nodes (in) side of the box contact inside the player node If the contact is done, take the parents (box) manually until the contact is registered. You box can be taken with something like box.position = CGPointMake (box.position.x, box.position.y + 1); . This will be done in updates: method.

Comments

Popular posts from this blog

Pass DB Connection parameters to a Kettle a.k.a PDI table Input step dynamically from Excel -

multithreading - PhantomJS-Node in a for Loop -

c++ - MATLAB .m file to .mex file using Matlab Compiler -