zencha Posted January 8, 2015 Share Posted January 8, 2015 Hey guys, I'm currently working through Discover Phaser making Thomas's Super Coin Box tutorial. I just created some tweens for when a player grabs a coin. The tweens play correctly, but afterwards the player begins slowly moving right without input and the coins begin moving up-left at a particular angle. Here's the relevant code:takeCoin: function(player, coin){ game.global.score += 5; this.scoreLabel.text = 'score: ' + game.global.score; this.coinSound.play(); this.updateCoinPosition(); }, updateCoinPosition: function(){ var coinPosition = [ {x: 140, y: 60}, {x: 360, y: 60}, {x: 60, y: 140}, {x: 440, y: 140}, {x: 130, y: 300},{x: 370, y: 300} ]; for (var i = 0; i < coinPosition.length; i++){ if (coinPosition[i].x === this.coin.x){ coinPosition.splice(i, 1); } } var newPosition = coinPosition[ game.rnd.integerInRange(0, coinPosition.length-1)]; this.coin.reset(newPosition.x, newPosition.y); this.coin.scale.setTo(0,0); game.add.tween(this.coin.scale).to({x: 1, y: 1}, 300).start(); game.add.tween(this.player.scale).to({x: 1.5, y: 1.5}, 50).to({x: 1, y: 1}, 150).start(); Link to comment Share on other sites More sharing options...
rich Posted January 9, 2015 Share Posted January 9, 2015 Can you check which version of Phaser this is please? This used to happen ages ago, but I've not seen it recently! Link to comment Share on other sites More sharing options...
zencha Posted January 9, 2015 Author Share Posted January 9, 2015 Looks like version 2.0.1. Link to comment Share on other sites More sharing options...
rich Posted January 10, 2015 Share Posted January 10, 2015 Upgrade. Link to comment Share on other sites More sharing options...
zencha Posted January 10, 2015 Author Share Posted January 10, 2015 Seemed to have fixed it. Can close this topic. Link to comment Share on other sites More sharing options...
Recommended Posts