BigSteve/PyGame/practice/gameprac/hybrid.py

54 lines
934 B
Python

# https://www.youtube.com/watch?v=f4coFYbYQzw&list=PLjcN1EyupaQkAQyBCYKyf1jt1M1PiRJEp
import os
os.environ['PYGAME_HIDE_SUPPORT_PROMPT'] = "hide"
import pygame
from pygame.locals import *
import random
WIDTH = 600
HEIGHT = 800
WINDOW_SIZE = (WIDTH, HEIGHT)
FPS = 60
# load background image
bg = pygame.image.load("PyGame\practice\gameprac\img")
def draw_bg():
screen.blit(bg, 0, 0)
WHITE = (255, 255, 255)
BLACK = (0, 0, 0)
RED = (255, 0, 0)
GREEN = (0, 255, 0)
BLUE = (0, 0, 255)
pygame.init()
pygame.mixer.init()
screen = pygame.display.set_mode(WINDOW_SIZE)
pygame.display.set_caption("Spave Invaders")
clock = pygame.time.Clock()
running = True
while running:
#draw background
draw_bg()
# event handlers
clock.tick(FPS)
for event in pygame.event.get():
if event.type == pygame.QUIT:
running = False
screen.fill(BLACK)
pygame.display.flip()
pygame.quit()