Pygame Tutorial: Add Playstation 4 Controller Support

แชร์
ฝัง
  • เผยแพร่เมื่อ 9 ก.ย. 2020
  • In this video, I'll be showing how you can use a Playstation 4 Controller with your game or python program using pygame. The PS4 controller can be hooked up to your PC with either a USB cable or bluetooth.
    The .json file containing the button keys and the test.py file I used can be downloaded here: github.com/ChristianD37/Youtu...
    Join my discord: / discord
    Music used in the video:
    Scarves - Shelter (8​-​Bit Remix) scarvesmusic.bandcamp.com/
    Final Fantasy IX - Crossing Those Hills
    Pixel art PS4 design by Vblank: / retrocr
    Pygame Joystick Documentation: www.pygame.org/docs/ref/joyst...
    Cool interface written by Clay Mcleod to use the PS4 controller in your program: gist.github.com/claymcleod/02...
    #Python #Pygame #PS4
  • เกม

ความคิดเห็น • 24

  • @mtbminibomber
    @mtbminibomber 3 ปีที่แล้ว +2

    Wow I never new that was actually possible
    Great work

  • @BekBrace
    @BekBrace 3 ปีที่แล้ว

    Great stuff, Christian!

    • @CDcodes
      @CDcodes  3 ปีที่แล้ว

      Thank you! I appreciate it :)

  • @DragonRazor9283
    @DragonRazor9283 3 ปีที่แล้ว

    This was so helpful even though I'm using this as a reference for my xbox controller. Thanks!

    • @CDcodes
      @CDcodes  3 ปีที่แล้ว +1

      Glad It helped : )

    • @xenoas1er197
      @xenoas1er197 2 ปีที่แล้ว

      Do someone know what are the inputs for L2 and R2 for the json file?

  • @user-tn9os8qf2y
    @user-tn9os8qf2y 10 หลายเดือนก่อน +1

    how do you use two controllers, I get how to have a 2nd one detected but that's it.

  •  2 ปีที่แล้ว

    Do you know of a way to program up an automated process that would press two DS4 buttons every 10 seconds? I am trying out a command in SoulCalibur 3 that enables the COM to control your character and I'd like to make it so every 10 seconds the one who controls the character would switch between myself or the COM. This switch I have set up to happen when L3 and square are pressed at the same time (for COM to play) and L3 + triangle (for me to play).
    I know it's kinda random but I have no knowledge whatsoever about python and my only programming experience is basic codes in c++ x)

    • @CDcodes
      @CDcodes  2 ปีที่แล้ว

      You could try using the time module to set a timer, and then every ten seconds set the boolean values of the buttons you want being pressed to True

  • @KingOfTheRedSkulls
    @KingOfTheRedSkulls 3 ปีที่แล้ว +1

    Hey Christian, can I try this in my project? Im unfamiliar with pygame however I am interested in getting the input from a Dualshock 4 so I can control something else, not a game

    • @CDcodes
      @CDcodes  3 ปีที่แล้ว

      Sure, go for it!

    • @KingOfTheRedSkulls
      @KingOfTheRedSkulls 3 ปีที่แล้ว

      @@CDcodes cool thanks, I picked up a raspberry pi today with some joysticks gonna try that first

  • @chaosspider5765
    @chaosspider5765 ปีที่แล้ว

    when i run the code it says "joystick system not initialised"

  • @xenoas1er197
    @xenoas1er197 2 ปีที่แล้ว +1

    what are the inputs for L2 and R2?

  • @lorenzogervasoni9927
    @lorenzogervasoni9927 3 ปีที่แล้ว

    what about the rumble?

    • @CDcodes
      @CDcodes  3 ปีที่แล้ว

      Thats a good question, im not sure. Maybe the Pygame documentation will have more info?

  • @asmeticful
    @asmeticful 3 ปีที่แล้ว +1

    What about xbox

    • @CDcodes
      @CDcodes  3 ปีที่แล้ว +1

      Very similar methods could be used for an Xbox controller!

  • @Shivesh4
    @Shivesh4 2 ปีที่แล้ว

    Hey Chritian i have got stuck somewhere
    can you please help?

    • @CDcodes
      @CDcodes  2 ปีที่แล้ว

      Hiya. What seems to be the issue?

    • @Shivesh4
      @Shivesh4 2 ปีที่แล้ว

      @@CDcodes Thankyou for replying
      the problem is that I want to apply the ps4 controls to my selfmade game but dont know how to? please help

    • @Shivesh4
      @Shivesh4 2 ปีที่แล้ว

      @@CDcodes I have also sent request on instagram plz accept we will talk there