Jump to content

Arcade overlap capture all sprite?


proyb2
 Share

Recommended Posts

I wish to capture more that one "person" sprites using the arcade overlap method but could only return the latest sprite which is "person3" instead of "person0", "person1", "person2", "person3"? How do I capture all?

for(var i=0;i<4;i++){person = game.add.sprite(500, 140+(i*20), 'pSprite');person.name="person"+iperson.enableBody = true;person.physicsBodyType = Phaser.Physics.ARCADE;game.physics.enable(person, Phaser.Physics.ARCADE);}robot = game.add.sprite(520, 200, 'robot');robot.enableBody = true;game.physics.enable(robot, Phaser.Physics.ARCADE);setTimeout(function(){game.physics.arcade.overlap(robot, person, HitsButton, null, this);}, 3000);function HitsButton(a,{console.log("hits",b.name)}
Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...