- Developed for Godot 4
- Click here to get the version compatible to Godot 3
- Documentação em Português
A virtual analog control for the directions:
- 360º (Vector2),
- 2_H (Horizontal),
- 2_V (Vertical),
- 4 (left, right, up, down)
- 8 (left["up, down"], right["up, down"], up, down)
In the example project, I show two examples of how to use a player with movements in Vector2, and with movements in predefined directions (alias).
- Download the file addon/analog.zip
- Place in your project's "addon" folder
- Access the Project Settings > Plugin and enable the "AnalogController" plugin
The AnalogController emits three signals!
- analogChange(force, pos)
- analogPressed
- analogRelease
To 360º type, the signal analogChange(force, pos)
the "force" parameter is a value (float) returned from "0.0 to 1.0"
To 2,4 e 8 (alias directions) force returns a normalized Vector2() with the calculated analog strength! And in the "pos" parameter, the position alias is returned ... "right, left, etc ..."
(boolean) isDynamicallyShowing
= The analog controller must appear dynamically, or fixed on the screen(typesAnalog) typeAnalogic
= DIRECTION_2_H, DIRECTION_2_V, DIRECTION_4, DIRECTION_8, DIRECTION_360(float,0.00,1.0) var smoothClick
= Time for the control to appear when clicking on the analog stick(float,0.00,1.0) var smoothRelease
= Time for the control to be hidden when releasing the analog(Texture) var bigBallTexture
= You can upload a texture of your choice to the larger ball (base) of the analog(Texture) var smallBallTexture
= You can load a texture of your choice for the smaller analog ball(Dictionary) directionsResult
= Here you can define the nicknames you want to return in each direction except for the 360º type
Will you use this code commercially? Rest assured you can use it freely and without having to mention anything, of course I will be happy if you at least remember the help and share it with friends, lol. If you feel at heart, consider buying me a coffee ❤️ -> https://ko-fi.com/thsbruno