Phaser.Plugin. VirtualJoystick

new VirtualJoystick()

A Virtual Joystick

Source - out/plugins/VirtualJoystick/VirtualJoystick.js, line 5

Methods

setVelocity(sprite, minSpeed, maxSpeed) → {Phaser.Sprite}

Given the speed calculate the velocity and return it as a Point object, or set it to the given point object.
One way to use this is: velocityFromAngle(angle, 200, sprite.velocity) which will set the values directly to the sprites velocity and not create a new Point object.

Parameters:
Name Type Argument Default Description
sprite Phaser.Sprite

The Sprite to set the velocity on. The Sprite must have a physics body already set. The value will be set into Sprite.body.velocity.

minSpeed number <optional>
0

The minimum speed the Sprite will move if the joystick is at its default (non-moved) position.

maxSpeed number <optional>
100

The maximum speed the Sprite will move if the joystick is at its full extent.

Returns:

The Sprite object.

Source - out/plugins/VirtualJoystick/VirtualJoystick.js, line 203
Phaser Copyright © 2012-2016 Photon Storm Ltd.
Documentation generated by JSDoc 3.4.3 on Thu Apr 13 2017 12:05:12 GMT-0700 (PDT) using the DocStrap template.