Mobile Joystick In Godot (Top-Down RPG Tutorial)
HTML-код
- Опубликовано: 6 фев 2025
- In this video, I will walk you through the step-by-step process of adding a virtual joystick to your mobile game using the Godot Engine.
If you're interested in adding touch buttons to your mobile game, check out the video here.
• How To Add Mobile Cont...
Assets
RPG pack - yurisantosart....
Character pack - merchant-shade...
Godot Version - 4.2.1
peak tutorial worked first try
I really liked your video, it helps a lot, it was worth my subscription, I wish it had godot multiplayer too
really helpful!
That was awesome! Thank you so much!
Glad you liked it! Thanks for watching.
You're a lifesaver dude😭🙏 please make more on mobile controls❤
and on this gamepad it works that if you just slightly tilt it, the character will move slowly, and the animation will also slow down? Is it possible to transfer such a function to the keyboard?
Recommended 🎉
i tried this; the side movement is working but the up and down movement is not working Please help me
In your Player script, are you defining what happens when Input up and Input down are triggered?
Bro make action keys and assign it to the joystick and your code, it will work
how do you have it at bottom left, mine goes to like middle left
nvm i figured it out
After downloading the same joystick, the VirtualJoystick inspector tab isn't showing up for me. So I don't have any of the properties available that you're having from 02:10 onward. This is a blank, brand new project, on 4.2.2 stable. What am I doing wrong?
Without seeing your project, it's hard to say for sure. I have two suggestions:
1. Make sure you are dragging the correct file onto your scene: `virtual_joystick_scene.tscn`.
2. Try adding it a different way. Go to `Project > Project Settings > Plugins` and ensure the virtual joystick plugin is enabled. Then, go back and try to add the joystick using the plus button in a scene, just like you would normally add a new node. It is called `Virtualjoystick` (`virtual_joystick.gd`).
@@WisconsiKnight Thanks for the swift reply, and apologies for not replying sooner. After a couple of days, I got the properties to appear on my Inspector tab. They initially don't appear, but if you change any of their properties inside the actual script itself, the changed property will appear inside the Inspector as well. For example, if you change "@export var action_left := "ui_left" " to "@export var action_left := "left" " inside the Joystick's script, the "Action Left" property will appear inside the Inspector tab. It's the same train of thought for any other properties shown on the footage as well (for any other Godot newbies like me out there). 👍
Is it possible to use a vector2 for the output of the joystick instead of input maps?
because i already have a lot of player code that relies on a vector2
You can catch the input vector in your script whether the input is being given through the joystick, keyboard, or game controller.
Without seeing and understanding your codebase, it's hard to give specific guidance. I hope this helps. Godot docs on movement overview: docs.godotengine.org/en/stable/tutorials/2d/2d_movement.html
How is your player moving in all directions fine with the same joystick but on mine when i go up pr down the character is walking in zig zag pattern?
Im on android how to set it to work for mobile?
Do what he did in video
Same I worked it out on my tab
My joystick is only moving the player left and right. How do I make it go all directions?
In your player script, you should capture and define user inputs for all desired directions to control character movement. Next, assign the same input maps defined in your settings to your joystick.
As far as animations of the character go., I'm using an AnimationPlayer to define animations for all 8 directions-though it's not necessary, as you could use just 4 directions. I'm using a BlendSpace2D in the AnimationTree to switch between animations based on character movement.
I think this Marco joystick is outdated? I couldn't find it in th latest version of Godot 4 and I installed the one in Godot 3.5. The picture of it is now a red paper that looks torn.
I was able to move up and down but it is very difficult to make it happen...I have to let the joystick go back to the center and after trying 20-30 times it finally goes up and down. I made sure my script is using ui_left etc. The player can go left or right very easily. The player can go up and down very easily IF I turn the left and right options off.
I'm having the same issue dude please guide me, I'm not in a condition to make my own💀@@Trendsthismonth
Bro make action keys and assign it to the joystick and your code, it will work @@Trendsthismonth
How do I call it in my player? it does not recognize it
You don’t reference the joystick in your player. Both your player and the joystick reference the Input Map in your settings. Check out 2:15
if you are using a CharacterBody2D as a base scene (class), then you have to rename the inputs that are inside the func _physics_process, by default they are like "ui_left" but it should be now, following this tutorial, just "left"