Question: What is the difference between checking if a key has been pressed by using: for event in pygame.event.get ( ) : if event.type = =

What is the difference between checking if a key has been pressed by using:
for event in pygame.event.get():
if event.type == KEYDOWN:
pass
or by using:
keys = pygame.key.get_pressed()
Question 6 options:
The first one will tell you if a key is currently being pressed whereas the second one will tell you if a key has been pressed once at some point
Both code snippets can be only used to check if a key is currently being pressed
Both code snippets can be only used to check if a key has been pressed at some point
The first one will tell you if a key has been pressed once at some point whereas the second one will tell you if a key is currently being pressed

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!