Python Forum
[PyGame] Pong game key.event problem
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[PyGame] Pong game key.event problem
#3
(Dec-12-2018, 02:48 PM)metulburr Wrote:
Quote:
if event.type == pygame.KEYDOWN:
this checks for a single event, not consistently holding down a key.

Put this not within the event loop but in the main game loop
keys = pygame.key.get_pressed()
if keys[pygame.K_UP] or keys[pygame.K_w]:
    pass
#etc.

Doh Thanks
Reply


Messages In This Thread
Pong game key.event problem - by erickDarko - Dec-12-2018, 02:33 PM
RE: Pong game key.event problem - by metulburr - Dec-12-2018, 02:48 PM
RE: Pong game key.event problem - by erickDarko - Dec-12-2018, 03:17 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Problem with pygame.event.clear qq12346 1 2,170 Oct-05-2023, 08:39 AM
Last Post: patriciainman
Exclamation pong paddles wont move skullkat232 5 2,460 Feb-13-2023, 03:53 PM
Last Post: Vadanane
  Problem with my pong code Than999 3 3,540 Oct-22-2021, 08:50 AM
Last Post: Qanima
  Game “Pong” I have problems with the code BenBach18 2 3,558 Jan-10-2021, 05:16 PM
Last Post: michael1789
  [PyGame] Creating Pong in Pygame Russ_CW 2 2,856 Oct-11-2020, 11:56 AM
Last Post: Russ_CW
  [PyGame] Problem With Entering Game Loop ElevenDecember 3 2,784 Jan-19-2020, 08:25 AM
Last Post: michael1789
  [PyGame] Problem when moving game window michael1789 15 9,061 Jan-17-2020, 01:40 PM
Last Post: metulburr
  Snake Game - obstacle problem Samira 3 5,739 Oct-31-2019, 02:58 PM
Last Post: Samira
  Trying to make a simple pong game. kevindadmun 1 3,959 Aug-05-2019, 06:39 AM
Last Post: kevindadmun
  Smiley Pong Help Jasmineleroy 6 4,818 May-22-2019, 11:36 AM
Last Post: metulburr

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020