FAQ Database Discussion Community


didBeginContact logic OSX swift

osx,swift,if-statement,logic,collisions
I am having some trouble with the logic inside of didBeginContact on an OSX game i'm creating. It is written in swift, here is what the code currently is: func didBeginContact(contact: SKPhysicsContact) { let collision: UInt32 = contact.bodyA.categoryBitMask | contact.bodyB.categoryBitMask if collision == PhysicsCategory.player | PhysicsCategory.wall { } else if...

What role does hashCode play when comparing two objects?

java,object,documentation,collisions
I've decided to study some primary documentation in Java. I've started with Object class and I am looking at the equals method. I know that equals is using hashCode method. Although, hashCode returns int so there are a limited number of unique hashcodes that can be generated. What will happen...