Это видео недоступно.
Сожалеем об этом.
How To Use Joysticks & Controllers in PyGame
HTML-код
- Опубликовано: 7 сен 2022
- Today we learn how to use joysticks and controllers in PyGame instead of keyboard and mouse.
◾◾◾◾◾◾◾◾◾◾◾◾◾◾◾◾◾
📚 Programming Books & Merch 📚
🐍 The Python Bible Book: www.neuralnine...
💻 The Algorithm Bible Book: www.neuralnine...
👕 Programming Merch: www.neuralnine...
🌐 Social Media & Contact 🌐
📱 Website: www.neuralnine...
📷 Instagram: / neuralnine
🐦 Twitter: / neuralnine
🤵 LinkedIn: / neuralnine
📁 GitHub: github.com/Neu...
🎙 Discord: / discord
🎵 Outro Music From: www.bensound.com/
Thank you for this video, direct to the point ,short and conside
Thank you for this tutorial. I used a slightly modified version of your code to get my sprite moving with a d-pad. Thanks again. AI was impressed with the efficiency of your code.
WARNING: PyGame will not work with Python 3.11!! As of 03 November 2022, there is no stable version of PyGame compatible with python 3.11, the latest stable version of Python. This tutorial WILL NOT WORK as intended; It is also recommended that you don't use the "--pre" flag when installing PyGame, as the develoipment versions downloaded could contain bugs, and are not recommended for use with stable versions of Python. @NeuralNine are there any alternative libraries that can be used instead? If so, can you try doing a tutorial on those? I would try using "uagame", but that does require that pygame needs to be installed.
NIce Implementation, Very Helpful
Bro absuloutly what I needed today. Thank you homie
This was awesome, helped me finish off my xbox 360 controller gui project. Thank you
EXCELLENT BUDDY , you make my day , keep it up and make this type video.
I need help, i Want to have the input forma my logitech steering wheel especially the throttle and the brake, cause pygame only see the buttons on the wheel not the throttle,brake, and clutch. Thanks
Here is my modified version without classes.
hero_speed = 2 #(global variable)
insert this in the while loop as an if statement:-
if game_active:
x_speed = round((pygame.joystick.Joystick(0).get_axis(0))*hero_speed)
hero_rect.move_ip(x_speed, 0)
When I run this , and I hit L2 on my ps4 controller no button number pops up but an axis number. What does this mean .? It’s an axis
Thank you for this tutorial. I would like to know how can we use Thrustmaster throttle and joystick in pygame.
i think you have to do (like tech with tim) a stream of 10 hour on make a game like street of rage but without any help...i think that raise your channel
Exactly what I needed thanks 👍
I can not get two pygame controllers to work. Cant find a good example anywhere.
thank you
A video explaining python classes and dataclasses would be nice
Especially with the help of this video. Once you find the particular inputs on each controller, you can make a custom class to represent each type of controller used in game. You will likely also need another class for each button, with a similar labeling style to make things easier if you go with this option. This will make printing each button on the controller a lot easier for degugging.
Sorry this doesn’t work at all with color changing and the rectangle isn’t even drawn to the screen.
THANK YOUUUUUUUUU
it does not work on pycharm just a warning
Nice👍
Thx_.
First
it a little weird, because i have written the exact same code as u but somehow my joystick is not being initialized even though i have used the pygame.joystick.init() line
pygame.joystick.init()
joysticks = [pygame.joystick.Joystick(x) for x in range(pygame.joystick.get_count())]