Skip to content

Instantly share code, notes, and snippets.

@alcidesjunior
Last active February 28, 2019 19:37
Show Gist options
  • Save alcidesjunior/26e0b347128239677a2ad74a749dd23f to your computer and use it in GitHub Desktop.
Save alcidesjunior/26e0b347128239677a2ad74a749dd23f to your computer and use it in GitHub Desktop.
//criando o corpo 1 que é em formato de circulo.
let element = SKShapeNode(circleOfRadius: 10)
element.position = CGPoint(x: 100 ,y: 140)
element.fillColor = .yellow
element.physicsBody = SKPhysicsBody(circleOfRadius: 10)
//setando configurações de colisão
element.physicsBody?.restitution = 1
element.physicsBody?.categoryBitMask = 2
element.physicsBody?.collisionBitMask = 1
element.physicsBody?.fieldBitMask = 0
element.physicsBody?.contactTestBitMask = 1
element.name = "ball"
addChild(element)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment