Jump to content

Virtual Joystick plugin


enpu
 Share

Recommended Posts

9 hours ago, enpu said:

Hello @BillyKane and welcome to Panda forums!

Thanks for your feedback. There are different buttons in the Essentials plugin: https://www.panda2.io/plugins#essentials

What exactly do you mean by "two finger touchpad"?

 
I think that he means Multi-Touch. right?? @BillyKane
 
My case:
the joystick of movement control on left hand side, the shoot button on right hand side of screen.
when I hold movement joystick and touch the ''shoot  button" on mobile.
it have an effect on movement control.
 
1.png.506d2d96b386dd843d7f873616f39ac8.png
 
My solution is disable joystick's mousedown function on right hand side of screen.
(but I’m Not Sure Is it the best way to solve the problem)
 
open the joystick.js file , and try this code on update 
update: function() {
        if(game.input.mouse.x < 550){
        if (!this.active) return;
        var angle = this._mouseDownPos.angle(game.input.mouse);
        var dist = this._mouseDownPos.distance(game.input.mouse);
        var radius = this.bg.shapes[0].shape.radius / 2;
        
        if (dist > radius) dist = radius;
        
        this.pad.position.x = Math.cos(angle) * dist;
        this.pad.position.y = Math.sin(angle) * dist;
        
        this.axis.x = this.pad.position.x / radius;
        this.axis.y = this.pad.position.y / radius;
        }
}

 

 
 
Link to comment
Share on other sites

  • 3 months later...

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...