Jump to content

Collide with child of object?


Amiga4ever
 Share

Recommended Posts

Hi,

I need some advice. 

I've created group: 

enemies = game.add.group();

 

Then I've created object from this group 

enemy_ship = enemies.create(0,0,'enemy_new');

 

Then I'm adding a child  of enemy_ship:

enemy_ship.laser= enemy_ship.addChild(game.add.sprite(-5000, 160, 'laser',0));

As you can see on attached image - enemy ship has laser beam...I want to collide/overlap  with it.

 

All working fine but I have problem how to collide with it. So my player need to collide/overlap with enemy_ship.laser

game.physics.arcade.overlap(enemies.laser, player,  this.laser_hit, null, this);

 

but doesn't work. is it even possible to collide/overlap  with object child?

 

Thanks

Heres my game BTW

http://marcinkrupinski.pl/projectX2/

 

Px.jpg

laser.jpg

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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