swift - didBeginContact() in SpriteKit is not working -


in spritekit project (swift), use, else, autofill feature in xcode. when type in didbegincontact, nothing comes up. try type out this...

func didbegincontact(contact: skphysicscontact) {  } 

but creates bran new function. type out function inside class, not created side function. has had had problem before? , know solution?

i've never heard autofill feature. have tell function, do, when somethings making contact. example:

func didbegincontact(contact: skphysicscontact) {     let firstbody : skphysicsbody = contact.bodya     let secondbody : skphysicsbody = contact.bodyb      collisionwithbullet(firstbody.node as! skspritenode, bullet: secondbody.node as! skspritenode) }  func collisionwithbullet(enemy: skspritenode, bullet: skspritenode) {      enemy.removefromparent() } 

this remove "enemy", when hits "bullet". can check out great tutorial jared davidson on youtube. https://www.youtube.com/watch?v=cew6scqv--o


Popular posts from this blog

php - How should I create my API for mobile applications (Needs Authentication) -

5 Reasons to Blog Anonymously (and 5 Reasons Not To)

Google AdWords and AdSense - A Dynamic Small Business Marketing Duo