Is it me or is pygame.key.get_pressed() not working?
Posted
by
user1321527
on Stack Overflow
See other posts from Stack Overflow
or by user1321527
Published on 2013-06-28T19:33:14Z
Indexed on
2013/06/29
4:21 UTC
Read the original article
Hit count: 77
okay, so I am making a basic space-ship game.
I can't get rotation to work because it scrambles the bitmap, but that's for another question.Should I even use a gif? any other filetype suggestions?
back to the actual point here, so:
k = pygame.key.get_pressed()
yeah, self explanatory. this doesn't work, as it returns each key as pressed.
so, somewhere else:
d = k[pygame.K_d]
and another line:
print d
and another:
if d:
So, k returns as each key on the keyboard pressed.
d returns 0 indefinitely, whether or not d is pressed.
d is always 0.
the statement about d therefore is never true.
Why is this happening?
© Stack Overflow or respective owner