Coder Social home page Coder Social logo

boyquotes / virtual-joystick-godot Goto Github PK

View Code? Open in Web Editor NEW

This project forked from marcofaziorandom/virtual-joystick-godot

0.0 1.0 0.0 173 KB

A simple virtual joystick for touchscreens, for both 2D and 3D games, with useful options.

License: MIT License

GDScript 100.00%

virtual-joystick-godot's Introduction

Godot-Virtual-Joystick

A simple virtual joystick for touchscreens, for both 2D and 3D games, with useful options.

Made with Godot Engine: https://godotengine.org

OPTIONS:

  • Joystick mode:

    • Fixed: The joystick doesn't move.
    • Dynamic: Every time the joystick area is pressed, the joystick position is set on the touched position.
    • Following: If the finger moves outside the joystick background, the joystick follows it.
  • Vector mode:

    • Real: return a vector with a lenght beetween 0 and 1; useful for implementing different velocity or acceleration.
    • Normalized: return a normalized vector.
  • Directions: The number of directions, e.g. a D-pad is joystick with 4 directions, keep 0 for a free joystick.

  • Simmetry Angle: the angle of simmetry of the directions.

  • Dead zone: If the handle is inside this range, in proportion to the background size, the output is zero.

  • Clamp zone: The max distance the handle can reach, in proportion to the background size.

HELP:

  • The Control parent of the joystick is the area in which the joystick can move in Dynamic or Following mode.
  • For moving the joystick inside is area, select it, right click and turn on "Editable Children" and simply move the 'Background' node. - With "Editable Children" turned on you can also edit the joystick textures and colors.
  • An example scene is provided in the "Test" folder.
  • To be able to use the joystick with the mouse, you have to go to Project settings -> Input Devices -> Pointing, and turn on the option "emulate touch from mouse".

HOW TO USE:

Create a CanvasLayer node and name it "UI", it'll contain all the UI elements, then add the Joystick scene as a child of the UI node and move it where you prefer (remember to turn on "Editable Children").

virtual-joystick-godot's People

Contributors

marcofaziorandom avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.