Jump to content

Search the Community

Showing results for tags 'long press'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • HTML5 Game Coding
    • News
    • Game Showcase
    • Facebook Instant Games
    • Web Gaming Standards
    • Coding and Game Design
    • Paid Promotion (Buy Banner)
  • Frameworks
    • Pixi.js
    • Phaser 3
    • Phaser 2
    • Babylon.js
    • Panda 2
    • melonJS
    • Haxe JS
    • Kiwi.js
  • General
    • General Talk
    • GameMonetize
  • Business
    • Collaborations (un-paid)
    • Jobs (Hiring and Freelance)
    • Services Offered
    • Marketplace (Sell Apps, Websites, Games)

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Website URL


Twitter


Skype


Location


Interests

Found 1 result

  1. Note: I'm using lodash utility library together with Phaser I wanted to trigger the dragging event of a sprite after a "long press" event from an onInputDown event which is determined on the update function via a delta property. The problem is, the dragging event is not triggered after enabling it using card.input.enableDrag(). I've also used the dispatch() function that looks like this: card.events.onDragStart.dispatch(), the dragging will start but it will not update the position of the sprite. I also wanted to disable the dragging after onDragStop, so that I can "long press" it again and enable dragging. var card;create: function() { // Initialize card sprite card = this.add.sprite(x, y, 'card'); card.inputEnabled = true; // Add Event Handlers card.events.onInputDown.add(eventCardInputDown); card.events.onDragStart.add(eventCardDragStart); card.events.onDragStop.add(eventCardDragStop); // Set delta for long press to null card.delta_long_press = null;},update: function() { // Check if card is not yet draggable and delta_long_press is not null if(card.input.draggable == false && !_.isNull(card.delta_long_press)) { var timesince = _.now() - card.delta_long_press; // Check if timesince is greater than or equal to a second // Then enable dragging of the card if(timesince >= 1000) { card.input.enableDrag(); } }},eventCardInputDown: function() { // Set delta_long_press to now card.delta_long_press = _.now();},eventCardDragStart: function() { console.log('DRAG START'); // Some code},eventCardDragStop; function() { console.log('DRAG STOP'); // Some code}
×
×
  • Create New...