m4rk2s Posted October 27, 2016 Share Posted October 27, 2016 Hello everyone, is it possible to have to click twice for each tween here are the assets https://github.com/aneurycasado/Dominos-Para-Los-Dominicanos-No-Server/tree/master/images/Dominos var a, b playState = { init: function(){ game.device.desktop, game.scale.pageAlignHorizontally = !0, game.scale.pageAlignVertically = !0, document.body.style.backgroundColor = "#CCCCCC", game.stage.backgroundColor = "#000", game.physics.startSystem(Phaser.Physics.ARCADE) }, preload: function() { game.load.image("46", "assets/[4,6].png") game.load.image("16", "assets/[1,6].png") }, create: function() { this.init() game.world.setBounds(0, 0, 800, 600); a = game.add.image(100, 500, "46"); a.scale.setTo(0.3) a.anchor.set(.5, .5); b = game.add.image(700, 300, "16"); b.scale.setTo(0.3) b.anchor.set(.5, .5); // Mouse click events this.game.input.onDown.add(this.translate, this); this.game.input.onDown.add(this.rotate, this); }, translate: function(pointer){ var c = game.add.tween(a).to({x: 400, y: 300, angle: 0, alpha: 1}, 1000, "Quad.easeInOut", true, 1000); }, rotate: function(pointer){ var c = game.add.tween(b).to({angle: 45}, 2000, Phaser.Easing.Linear.None, true) } }, game = new Phaser.Game(800, 600); game.state.add("play", playState), game.state.start("play"); Link to comment Share on other sites More sharing options...
squilibob Posted October 27, 2016 Share Posted October 27, 2016 Use onTap // Mouse click events this.game.input.onTap.add(this.translate, this); this.game.input.onTap.add(this.rotate, this); }, translate: function(pointer, doubleclick){ if (doubleclick) var c = game.add.tween(a).to({x: 400, y: 300, angle: 0, alpha: 1}, 1000, "Quad.easeInOut", true, 1000); }, rotate: function(pointer, doubleclick){ if (doubleclick) var c = game.add.tween(b).to({angle: 45}, 2000, Phaser.Easing.Linear.None, true) } m4rk2s 1 Link to comment Share on other sites More sharing options...
m4rk2s Posted October 27, 2016 Author Share Posted October 27, 2016 thank you but it does the same thing like with only one click is the second argument (or parameter) doubleclick make a difference ? Link to comment Share on other sites More sharing options...
Recommended Posts