Godot Touch Screen Joystick tutorial

DaveTheCoderDaveTheCoder Posts: 163Member
edited January 12 in General Chat

Thanks, TwistedTwigleg. Your joysticks tutorial worked perfectly in the current version of Godot. =)
https://randommomentania.com/2018/08/godot-touch-screen-joystick-part-1/

There was a license document for the assets, but I didn't see one for the script. Are there any restrictions on its use?

Comments

  • TwistedTwiglegTwistedTwigleg Posts: 3,956Admin
    edited January 12

    @DaveTheCoder said:
    Thanks, TwistedTwigleg. Your joysticks tutorial worked perfectly in the current version of Godot. =)
    https://randommomentania.com/2018/08/godot-touch-screen-joystick-part-1/

    There was a license document for the assets, but I didn't see one for the script. Are there any restrictions on its use?

    Thanks @DaveTheCoder =)
    There isn’t any restrictions on the code, you can do with it as you see fit.

  • DaveTheCoderDaveTheCoder Posts: 163Member

    Thanks.

    One thing I'm curious about.

    Why did you set up the tiles in a separate scene (Tilemap_Scene.tscn), using Sprites and CollisionShape2D nodes, rather than using the TileSet panel to set up the collision shapes?

    Did the feature not exist when you wrote the tutorial?

  • TwistedTwiglegTwistedTwigleg Posts: 3,956Admin
    edited January 13

    @DaveTheCoder said:
    Thanks.

    One thing I'm curious about.

    Why did you set up the tiles in a separate scene (Tilemap_Scene.tscn), using Sprites and CollisionShape2D nodes, rather than using the TileSet panel to set up the collision shapes?

    Did the feature not exist when you wrote the tutorial?

    I think it didn't exist at the time or it wasn't as widely documented, I do not remember right off, sorry :sweat_smile:

  • DaveTheCoderDaveTheCoder Posts: 163Member

    I noticed that there are three virtual joysticks in the Godot Asset Library:
    https://godotengine.org/asset-library/asset?category=&godot_version=&sort=updated&filter=joystick

    If you've used them, how would you rank them in comparison to the one linked in the first post of this thread?

  • TwistedTwiglegTwistedTwigleg Posts: 3,956Admin

    @DaveTheCoder said:
    I noticed that there are three virtual joysticks in the Godot Asset Library:
    https://godotengine.org/asset-library/asset?category=&godot_version=&sort=updated&filter=joystick

    If you've used them, how would you rank them in comparison to the one linked in the first post of this thread?

    I haven't used any of them, so I cannot say. I looked through the code for one of them at one point and it had an different way of handling it that I hadn't considered initially, but I forget which one it was I looked at.

  • DaveTheCoderDaveTheCoder Posts: 163Member

    I wanted to reduce the size of the joystick.

    I was able to do it by reducing the size of the two images Godot_TouchScreen_Joysticks_JoyBG.png and Godot_TouchScreen_Joysticks_Joy.png, and then adjusting their positions.

    Is it possible to do this by changing properties (e.g. scaling) and not changing the images? I experimented with this, but without success.

  • TwistedTwiglegTwistedTwigleg Posts: 3,956Admin

    @DaveTheCoder said:
    I wanted to reduce the size of the joystick.

    I was able to do it by reducing the size of the two images Godot_TouchScreen_Joysticks_JoyBG.png and Godot_TouchScreen_Joysticks_Joy.png, and then adjusting their positions.

    Is it possible to do this by changing properties (e.g. scaling) and not changing the images? I experimented with this, but without success.

    You can probably multiple the radius of the joystick by one of the axes of the TextureRect scale (x or y) as long as the change in scale is the same on both axes and then it probably would work. That's what I would try looking at if I was adding scaling support.

  • cyberealitycybereality Posts: 1,230Moderator

    You might want to investigate the drawing API. It is good for stuff like virtual joysticks, because you can draw it based on the pixel size on the screen, so it always looks good.

Sign In or Register to comment.