top of page

The library contains only one method "newJoystick"

lib.newJoystick(properties) returned joystick table

    "properties" contains 5 required values:

        properties.group (this parameter is optional, specify the parent as its value)

        properties.x

        properties.y

        properties.backgroundRadius

        properties.movedStickRadius

Returned from "newJoystick" table is your new joystick.

It includes 4 methods:

    isActivated() - returns true or false depending on whether the joystick is currently being used by the user.

    setCoords(x: integer, y: integer) - sets the position of the joystick on the screen.

    getCoords() - returns the position of the joystick.

    getVector() - returns table with "x" and "y" properties with values from -1 to 1. Within the radius of the background (if movestick is in the leftmost position, its coordinates will be equal to (-1;0))

And 2 circles objects named "backgound" and "movedStick".

You can design your joystick with this circles objects.

SET COORDINATES ONLY WITH joystick.setCoords(x, y)!!!

bottom of page