Anshu Posted July 20, 2015 Share Posted July 20, 2015 HI Guys, Need a help. How can I make a button collidable object? I am using a group of buttons each having a different label. when a bullet hits any button i want to extract that label of that particular button. var bullets; bullets = game.add.group(); bullets.enableBody = true; bullets.physicsBodyType = Phaser.Physics.ARCADE; game.physics.enable(bullets, Phaser.Physics.ARCADE); var button = game.add.button(100, 400, 'button'); game.physics.enable(button, Phaser.Physics.ARCADE); game.physics.arcade.collide(bullets, button, collisionHandler, null, this); function collisionHandler (bullet, button) { button.kill();bullet.kill();} But my bullet is not colliding with the button. Please help!!!!! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.