Jump to content

don`t collide group with bottom and up world bounds phaser


oobarbazanoo
 Share

Recommended Posts

If I have a group, how can I disable its colliding with top and bottom? Here is a code which I apply to every sprite in group:

 enemy.enableBody = true;

    enemy.body.gravity.y = 2000;
    enemy.body.collideWorldBounds = true;
    enemy.body.bounce.y = 0.1;

    enemy.animations.add('attackMagic', Phaser.Animation.generateFrameNames('attackMagic/', 0, 24, '.png', 1), 7, false, true);
    enemy.animations.add('attack', Phaser.Animation.generateFrameNames('attack/', 0, 5, '.png', 1), 10, false, true);
    enemy.animations.add('run', Phaser.Animation.generateFrameNames('run/', 0, 4, '.png', 1), 10, true, true);
    enemy.animations.add('idle', Phaser.Animation.generateFrameNames('stance/', 0, 3, '.png', 1), 10, true, true);
    enemy.animations.add('jump', Phaser.Animation.generateFrameNames('jump/', 0, 3, '.png', 1), 10, false, true);
    enemy.outOfBoundsKill = true;

 

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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