Jump to content

How to integrate the plugin "Virtual Joystick generic" with P2JS


kenshm
 Share

Recommended Posts

Hello,

Everything is in the title, I'd like to know how to integrate this plugin with P2JS ?
I used physics.ARCADE and here is what my code looked like :

- Activate the plugin :

this.pad = this.game.plugins.add(Phaser.VirtualJoystick);this.stick = this.pad.addStick(0, 0, 300,'arcade');this.stick.scale = 1.2;		this.stick.alignBottomLeft(50);

 

- Move my ship :

var speed = 500;if(this.stick.isDown){	this.physics.arcade.velocityFromRotation(this.stick.rotation, this.stick.force * speed, this.fighter.body.velocity);	this.fighter.rotation = this.stick.rotation;}else{	this.fighter.body.velocity.set(0);}

 

My question is : "How to make it compatible this code with physics.P2JS" ?

Thank you to those who take the time to answer me.
Best regards,
Kenshimdev

 

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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