pranadevil Posted January 11, 2015 Share Posted January 11, 2015 hi buddies, got this code : additem:function() { box_ = this.box.getRandom(); if(!box_){ gameText.setText("now: NULLLLLLLLLLLLL"+box_.name); return; } gameText.setText("now: "+box_.name); box_.anchor.setTo(0.5,0.5); box_.reset(20,740); box_.body.velocity.x = -50; } but when running got the error ;Uncaught TypeError: Cannot read property 'velocity' of null ........................................... line 150 (box_.body.velocity.x = -50;) this.box is a group with several sprites, fullfilled with a for loop. gameText is a text variable in which i got the name of each item, but it nevers shows "NULLLLLLLLLLLL" so what im forgetting? why the box_ variable doesnt has the body.velocity.x ??? thanks in advance Link to comment Share on other sites More sharing options...
pranadevil Posted January 11, 2015 Author Share Posted January 11, 2015 nevermind i missed enableBody = true Link to comment Share on other sites More sharing options...
Recommended Posts