objective c - Sprite Kit Detecting Collisions -


Sorry for reopening this title, but no title about this question has helped me so much. In my game you are a space ship and you are trying to avoid the incoming asteroids. When your ship touches an asteroid, then you blast my code like this; Fixed const uint32_t asteroidCategory = 1; Static Const UIT 32_T Player Category = 2; Static Const UIT 32_ T Laser Category = 3; Player.physicsBody.categoryBitMask = playerCategory; Player.physicsBody.contactTestBitMask = asteroid class; Player.physicsBody.collisionBitMask = 0; Asteroid.physicsBody.categoryBitMask = asteroidCategory; Asteroid.physicsBody.contactTestBitMask = playerCategory; Asteroid.physicsBody.collisionBitMask = 0;

But I do not know what I should do on 'didBeginContact' method. Please help me, thank you ...

 Try -> (Zero) was done with Bijin Contact: (SKPSISCactact *) Contact {SKFISHICKSBODY * FIRST BODY, * SECOND BODY; If (contact.bodyA.categoryBitMask & lt; contact.bodyB.categoryBitMask) {firstBody = contact.bodyA; SecondBD = Contact BB; } And {firstBody = contact.bodyB; Second body = contact A A; } If ((firstBody.categoryBitMask and PlayerCategory)! = 0 & amp; amp; amp; amp; amp; amp; amp; amp; amp; amp; amp; amp; secondBody.categoryBitMask & amp; astroidCategory)! = 0) {[Self Player: (SKSpriteNode *) firstBody.nodeCollideWithAstroid: ( SKSpriteNode *) secondBody node]; }   

You also need to create a method for 'didCollideWithAstroid'

Comments

Popular posts from this blog

php - PDO bindParam() fatal error -

logging - How can I log both the Request.InputStream and Response.OutputStream traffic in my ASP.NET MVC3 Application for specific Actions? -

java - Why my included JSP file won't get processed correctly? -