0

enter image description here

If I click to go to another scene then my app crashes.

mnuages
  • 13,049
  • 2
  • 23
  • 40
  • 1
    Why are you conditional-setting 2 properties of `physicsBody` and then you are setting a new `SKPhysicsSprite` (losing the previous values)? – Luca Angeletti Dec 18 '15 at 21:11
  • can you explain for me ? @appzYourLife –  Dec 19 '15 at 00:12
  • He's saying that the line "cUm.physicsBody = SKPhysicsBody..." should be first right after you change the background color. In other words, you're changing properties of an SKPhysicsNode? and then you create a whole new object and overrides all previous code. You have to create the object first. – Hedylove Dec 19 '15 at 07:27
  • How Can I Fix This ERROR ? please help me –  Dec 19 '15 at 21:35

1 Answers1

0

Put the error line after the position line.

cUm.position....
cUm.physicsBody = SKPhysicsBody(...
cUm.physicsBody.dynamic...
....

You need to do this for all ur bodies. Always create your physics body first, and than set the properties such as dynamic etc.

crashoverride777
  • 10,581
  • 2
  • 32
  • 56