illscode Posted November 10, 2015 Share Posted November 10, 2015 Hi All, phaser newb, novice js I'm trying to build a little christmas game, sort donkey kong-ish, with some gifts that go along some conveyer belts into santa's bag (attached a pic). I'm creating a group of gift sprites behind the pipe in the top right. I want to add gravity to each one but over time so they stream out of the pipe in sequence. Would you do this in the update: function() . Is there a way to create the sprites over time and add them to the group? Can your add a delay somehow? cheers for any advice/help in advance here's my js for the groupbuildGifts: function(){ this.giftgroup = this.add.group(); this.giftgroup.enableBody = true; for(var i=0; i<this.totalGifts; i++){ var g = this.giftgroup.create(1000, 80, 'blueGift', 0000); g.anchor.setTo(0.5,0.5); g.body.moves = true; g.animations.add('gifted', Phaser.Animation.generateFrameNames('gift', 0, 0, '', 4), 30, true); this.game.physics.arcade.enable(g); g.body.bounce.y = 0.2; // g.body.gravity.y = 1500; g.body.velocity.x = 0; g.inputEnabled = true; g.events.onInputDown.add(this.destroyGift, this); } Link to comment Share on other sites More sharing options...
illscode Posted November 10, 2015 Author Share Posted November 10, 2015 Hey all, figure it out with the info on this link:http://www.html5gamedevs.com/topic/2933-how-to-add-delays-in-phaser/ Link to comment Share on other sites More sharing options...
Recommended Posts