Jump to content

separate a click with two tweens


m4rk2s
 Share

Recommended Posts

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

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)
    }

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

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