Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save iamutkarshtiwari/7c5731a48726fb58526417edb2f61c15 to your computer and use it in GitHub Desktop.

Select an option

Save iamutkarshtiwari/7c5731a48726fb58526417edb2f61c15 to your computer and use it in GitHub Desktop.
import sys
import pygame
import time
import random
import os
WIDTH = 360
HEIGHT = 360
FPS = 360
pygame.init()
pygame.mixer.init()
screen = pygame.display.set_mode((WIDTH, HEIGHT))
pygame.display.set_caption("My Game")
clock = pygame.time.Clock()
# Variables
img1 = pygame.image.load(os.path.abspath("watercycle.png"))
# Game Loop
running = True
while running:
# keep loop running at the right speed
clock.tick(FPS)
# Process input (events)
for event in pygame.event.get():
# check for closing window
if event.type == pygame.QUIT:
running = False
screen.fill(BLACK)
screen.flip(img1)
# after drawing everything, flip the display
pygame.display.flip()
pygame.quit()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment