def main(): # Initialize Pygame pygame.init() # Create the screen screen = pygame.display.set_mode((640, 480)) # Load the images player_image = pygame.image.load("player.png") enemy_image = pygame.image.load("enemy.png") # Create the player and enemy objects player = pygame.Rect(100, 100, 50, 50) enemy = pygame.Rect(500, 100, 50, 50) # Main loop while True: # Handle events for event in pygame.event.get(): if event.type == pygame.QUIT: pygame.quit() exit() # Move the player if pygame.key.get_pressed()[pygame.K_LEFT]: player.x -= 10 elif pygame.key.get_pressed()[pygame.K_RIGHT]: player.x += 10 # Check if the player hit the enemy if player.colliderect(enemy): # Game over print("You lose!") break # Draw the screen screen.fill((0, 0, 0)) screen.blit(player_image, player) screen.blit(enemy_image, enemy) pygame.display.update() if __name__ == "__main__": main()
top of page

The Basics

Mind Matters

Mind Matters

Mind Matters
Mind Matters: How do Drugs Work on the Brain?

Mind Matters: How do Drugs Work on the Brain?

00:48
Mind Matters: How do Drugs Affect Your Life?

Mind Matters: How do Drugs Affect Your Life?

00:29
Mind Matters: How do You Become Addicted to Nicotine?

Mind Matters: How do You Become Addicted to Nicotine?

00:37
Mind Matters: How do Vaping Devices Work?

Mind Matters: How do Vaping Devices Work?

00:46
bottom of page