Jump to content

Sprites in group(collide with each other) still overlap?


akanarika
 Share

Recommended Posts

in function create():

 

 
create 15 cubes on the top of gameworld:
 
stars = game.add.group();for (var i = 0; i < 15; i++)     {        var star = stars.create(375, -50, 'star');        game.physics.arcade.enable(star);        star.enableBody = true;        star.body.collideWorldBounds = true;        star.body.immovable = true;     }

timer:

game.time.events.loop(Phaser.Timer.SECOND, updateCounter, this);

in function updateCounter, make the cubes fall down one by one:

if(i<15){live = stars.getAt(i);live.body.immovable = false;live.body.gravity.y = GRAVITY;//live.body.velocity.y  = 90;i++;}

 

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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