Sign in to follow this  
enpu

Virtual Joystick plugin

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

 

 
 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.