gached Posted January 31, 2018 Share Posted January 31, 2018 Hi everyone, I just bought the Phaser plugin for joysticks and I'm trying to create a game using two sticks to move a car. One controls the speed and the other controls the direction of the car. The problem is: the force of both sticks seems to be interfering with eachother, so when I press one of the sticks, the force applied to the other stick also increases. class Joystick { constructor(p_game) { this.m_game = p_game; this.m_pad1 = this.m_game.plugins.add(Phaser.VirtualJoystick); this.m_directionStick = this.m_pad1.addStick(0, 0, 200, 'joystickAtlas'); this.m_directionStick.motionLock = Phaser.VirtualJoystick.HORIZONTAL; this.m_directionStick.alignBottomLeft(20); this.m_pad2 = this.m_game.plugins.add(Phaser.VirtualJoystick); this.m_speedStick = this.m_pad2.addStick(0, 0, 200, 'joystickAtlas'); this.m_speedStick.motionLock = Phaser.VirtualJoystick.VERTICAL; this.m_speedStick.alignBottomRight(20); } update(p_delta) { console.log("direction force: ",this.m_directionStick.force) console.log("speed force: ",this.m_speedStick.force) } } At first I had both stick on the same pad "this.m_pad1" but the results were the same. The logs show that the force are changing in both sticks when one of them is beign used. Thank you in advance! Link to comment Share on other sites More sharing options...
Recommended Posts