jak6jak Posted March 15, 2014 Share Posted March 15, 2014 http://pastebin.com/1BMsEKQr it keeps giving me this error: TypeError: Cannot read property 'velocity' of null on line 98 Link to comment Share on other sites More sharing options...
StrykerKKD Posted March 15, 2014 Share Posted March 15, 2014 Maybe you should enable the physics for the water as you did with the floor and the player.game.physics.enable(floor, Phaser.Physics.ARCADE); Link to comment Share on other sites More sharing options...
jak6jak Posted March 15, 2014 Author Share Posted March 15, 2014 ok but now it is giving me this error: Cannot call method 'getFirstDead' of undefined on line 97 what am I doing wrong there? Link to comment Share on other sites More sharing options...
StrykerKKD Posted March 15, 2014 Share Posted March 15, 2014 Overwriting your group with a sprite is a bad thing.water = water.getFirstDead();First: make a firstDeadWater variable outside the update loop andfirstDeadWater = water.getFirstDead()Use this variable instead of water. Link to comment Share on other sites More sharing options...
rich Posted March 16, 2014 Share Posted March 16, 2014 Groups are a collection of objects. They have no physics body of their own, no texture of their own, no input handling.. they're just like bags of objects, so as such you can't apply any velocity to them. WombatTurkey 1 Link to comment Share on other sites More sharing options...
rich Posted March 16, 2014 Share Posted March 16, 2014 Although this is a good time to point out - do you realise you can add children to a Sprite too? So you could have a parent sprite, that has a physics body, and then just add children to it (Sprite.addChild) that will move quite happily along with their parent. Note that should you collide the parent sprite it's children will be ignored in that check. Rocco, jerome, chadn and 1 other 4 Link to comment Share on other sites More sharing options...
Recommended Posts