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.

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.

Phaser.Sprite-

The Sprite object.

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