vmars316 Posted January 23, 2016 Share Posted January 23, 2016 Hello & Thanks : I am having trouble getting bullets to go : Quote // Our ships bullets bullets = game.add.group(); bullets.enableBody = true; bullets.physicsBodyType = Phaser.Physics.ARCADE; // All 40 of them bullets.createMultiple(40, 'bullet'); bullets.setAll('anchor.x', 0.5); bullets.setAll('anchor.y', 0.5); function fireBullet () { if (game.time.now > bulletTime) { bullet = bullets.getFirstExists(false); if (bullet) { bullet.reset(throwerSprite.body.x + 16, throwerSprite.body.y + 16); bullet.lifespan = 2000; bullets.body.velocity.y = -300; // bullets.body.acceleration.y = -300; bulletTime = game.time.now + 50; } } } I get error :Uncaught TypeError: Cannot read property 'velocity' of undefined m-vertical-collision.js:124 Pls , what do I need to make this puppy go ? Thanks Link to comment Share on other sites More sharing options...
vmars316 Posted January 23, 2016 Author Share Posted January 23, 2016 Oops ! Changed bullets to bullet , voila . Link to comment Share on other sites More sharing options...
Recommended Posts