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
Sorry for bad audio quality
Don't worry, mine was pretty bad too!
But the video was so good that the audio isn't any thing any one will worry about thank you.
it's ok! can i download the pictures some-place?
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?
I liked Gonkee's Joystick. But this one is easy to understand and apply
Glad you find it helpful...
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?
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.
I need this, but with a real joystick, of XBox controller. Please, a tutorial about that.
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 🐹
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.
@@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.
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.
@@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!
@mylordbibbles8498 i have the same error what did you do to solve it ???
Can I use it for an animated Sprite
it's incompatible with two or more joysticks:-(
Yeah, code has to change a little bit for multiple joystick
درند ايش تسوي هنا (:
Where is the code
here: dicode1q.blogspot.com/2021/06/how-to-create-joystick-in-godot.html
I have also updated the code link in the description.
Where is the code
check description