Skip to content

Commit

Permalink
Merge pull request #10 from Schulich-Ignite/main_with_events
Browse files Browse the repository at this point in the history
Update main_COPY_AND_RENAME.py with events
  • Loading branch information
anandp1 authored Feb 21, 2021
2 parents 6d3141c + fb16546 commit 8a4167b
Showing 1 changed file with 24 additions and 3 deletions.
27 changes: 24 additions & 3 deletions main_COPY_AND_RENAME.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,28 @@
if event.type == pygame.QUIT: # When user clicks the 'x' on the window, close our game
pygame.quit()
sys.exit()


# Keyboard events
keys_pressed = pygame.key.get_pressed()
if keys_pressed[pygame.K_UP]:
pass # Replace this line
if keys_pressed[pygame.K_LEFT]:
pass # Replace this line
if keys_pressed[pygame.K_RIGHT]:
pass # Replace this line
if keys_pressed[pygame.K_DOWN]:
pass # Replace this line

# Mouse events
mouse_pos = pygame.mouse.get_pos() # Get position of mouse as a tuple representing the
# (x, y) coordinate

mouse_buttons = pygame.mouse.get_pressed()
if mouse_buttons[0]: # If left mouse pressed
pass # Replace this line
if mouse_buttons[2]: # If right mouse pressed
pass # Replace this line



"""
Expand All @@ -42,9 +63,9 @@
DRAW section - make everything show up on screen
"""
screen.fill(BLACK) # Fill the screen with one colour



pygame.display.flip() # Pygame uses a double-buffer, without this we see half-completed frames
clock.tick(FRAME_RATE) # Pause the clock to always maintain FRAME_RATE frames per second

0 comments on commit 8a4167b

Please sign in to comment.