how to make a joystick in Godot | explained | Dicode

Поделиться
HTML-код
  • Опубликовано: 8 сен 2024
  • if you have question like
    1. how to make a touch joystick in godot ?
    2. how to make a joystick for android in godot ?
    3. how to make a simple joystick in godot
    then you are at right place. Creating joystick is very simple and easy to make in Godot
    in this video I have explained how this joystick work and how you can create your own
    Watch complete video and you will able to make joystick on your own
    ---------------------------------------------
    Code:
    dicode1q.blogs...
    ---------------------------------------------
    If you face any problem write down in the comment section
    Like, Subscribe and Share this video

Комментарии • 24

  • @dicode1q
    @dicode1q  3 года назад +8

    Sorry for bad audio quality

    • @SaiponathGames
      @SaiponathGames 3 года назад +1

      Don't worry, mine was pretty bad too!

    • @thomasparker7305
      @thomasparker7305 3 года назад +2

      But the video was so good that the audio isn't any thing any one will worry about thank you.

    • @cheers9430
      @cheers9430 Год назад +1

      it's ok! can i download the pictures some-place?

  • @zuzuminx
    @zuzuminx Год назад +1

    I have a question. How would I change the direction of the player to be more like a pointer? Like if you were to imagine a tank with a cannon and instead of moving the tank in a direction, you move the tank in the direction that the cannon is pointing to, making the cannon more of a pointer. You can get this by changing , if the sprite where a man, to be horizontal but what if you're going from running on land and now you want to dive?

  • @vikramthewrench
    @vikramthewrench 3 года назад +3

    I liked Gonkee's Joystick. But this one is easy to understand and apply

    • @dicode1q
      @dicode1q  3 года назад +3

      Glad you find it helpful...

  • @ceyhundirilce
    @ceyhundirilce Год назад +1

    Hello. the codes are the same but after clicking and releasing the button, the joystick becomes invisible. I did not use different codes. Is it because of the control tool? Is there a solution to this?

    • @otoyoki7003
      @otoyoki7003 Год назад

      The reason why the stick disappears is that under "func _on_TextureButton_button_up():" he wrote "js_bg = js_pos", but what this does is set the node to the position, not set the node's rect position to the position. Therefore, you have to switch the line to "js_bg.rect_position = js_pos" for it to return.

  • @alexlealch
    @alexlealch Год назад

    I need this, but with a real joystick, of XBox controller. Please, a tutorial about that.

  • @zuzuminx
    @zuzuminx Год назад +1

    I know it's been a whole year but I have an issue and I'm hoping you'll respond. I get the error "Invalid set index 'rect_position' (on base: "Vector2') with value of type 'Vector2'." I'm not sure what that means, any help would be great! Thanks 🐹

    • @dicode1q
      @dicode1q  Год назад

      Can't tell exactly where the problem is because I don't know what your code.
      But I think you are setting position on a node whose instance has not been created yet.

    • @zuzuminx
      @zuzuminx Год назад

      @@dicode1q oh shoot! Sorry I forgot to add where! It's under the player script by:: if valid_pos:
      5th line
      js_bg.rect_position = Vector2(start_pos.x - 32, start_pos.y - 32) (my sprite is 64 by 64)
      it just rotates the player, doesn't move it forward unfortunately.

    • @dicode1q
      @dicode1q  Год назад +1

      I don't se any problem with this line.
      I have given code in the description you can copy the code to reduce chances of errors.
      Also, make sure you connect both swipe_detect and swipe_end signal to the script.

    • @zuzuminx
      @zuzuminx Год назад

      @@dicode1q I got it to work! I should've just copied/paste the code from your website 🙄🙄 I left out a few things lol Thank you, this helped a lot!

    • @MadFroggysTech
      @MadFroggysTech Год назад

      @mylordbibbles8498 i have the same error what did you do to solve it ???

  • @Dev_Crafted
    @Dev_Crafted 3 года назад

    Can I use it for an animated Sprite

  • @alexeyohhh9536
    @alexeyohhh9536 2 года назад +1

    it's incompatible with two or more joysticks:-(

    • @dicode1q
      @dicode1q  2 года назад

      Yeah, code has to change a little bit for multiple joystick

  • @kingandroid5088
    @kingandroid5088 Год назад +1

    درند ايش تسوي هنا (:

  • @rpg353
    @rpg353 2 года назад

    Where is the code

    • @dicode1q
      @dicode1q  2 года назад

      here: dicode1q.blogspot.com/2021/06/how-to-create-joystick-in-godot.html
      I have also updated the code link in the description.

  • @rpg353
    @rpg353 2 года назад

    Where is the code

    • @dicode1q
      @dicode1q  2 года назад

      check description