Open OmeGaCinoS opened 10 years ago
Same question here. Could you please offer some simple examples? Cheers!
The example code listed in README is incorrect. Here's the correct example to configure joystick:
GameController.init( {
left: {
type: 'joystick',
position: { left: '15%', bottom: '15%' },
joystick: {
touchStart: function() {
console.log('touch starts');
},
touchEnd: function() {
console.log('touch ends');
},
touchMove: function( details ) {
console.log( details.dx );
console.log( details.dy );
console.log( details.max );
console.log( details.normalizedX );
console.log( details.normalizedY );
}
}
},
right: {
type: 'joystick',
position: { right: '15%', bottom: '15%' } ,
joystick: {
touchMove: function( details ) {
// Do something...
}
}
}
});
Please note, that you have to enclose touchStart, touchEnd and touchMove functions inside joystick
object. I would suggest you to read Advanced Options Section carefully.
Hello!
I found your virtual game controller and I try to put in, in my game but... I can't even use it because I dun understand how to use the joystick.
I just wanna know where I can have joystick position, etc,
Thanks