Adding Mobile Touch and Mouse Input (part 2)
We have successfully included the new Mobile Touch/Mouse input helper file. But how do we access it? Well, Jerome Etienne, creator of this helper file, has designed his library to be intuitive and easy to use. As we have done many times before, we must first declare a variable that will hold the 'virtualjoystick' object and all its properties and functionality. Open up our 'tempGame.js' file and add the following line near the top: var joystick = new VirtualJoystick({ mouseSupport: true }); There is some difference in the look of the above code compared to how we declared a 'keyboard' variable a couple of posts back. Going line by line, we use the 'var' keyword followed by a name for our game controller, in this case 'joystick'. Then comes the '= new' which fills 'joystick' with whatever comes next. And what comes next is a call to 'VirtualJoystick({ });' Notice this...