swift - Best way to "eat" something in SpriteKit -


by "eat" mean: when sprite (mario) collides sprite b (a coin) collision detected , coin removed scene; however, mario's movement not altered collision coin.

at moment i'm using skphysicscontactdelegate register when mario , coin collide, seems require acknowledging coin physical body - therefore means mario's movement stopped it.

should coin not have physics body, , instead should use different method see if contact?

according apple...

var categorybitmask: uint32 mask defines categories physics body belongs to.

var collisionbitmask: uint32 mask defines categories of physics bodies can collide physics body.

var contacttestbitmask: uint32 mask defines categories of bodies cause intersection notifications physics body.

so if set contacttestbitmask on "mario" coin categorybitmask, , set collisionbitmask on "mario" 0 (or not coin categorybitmask) should able tell when 2 collide in didbegin(_ contact: skphysicscontact) func coin not impede mario's movement


Comments

Popular posts from this blog

angular - Ionic slides - dynamically add slides before and after -

minify - Minimizing css files -

Add a dynamic header in angular 2 http provider -