The code sample below does not work as intended.
import pygame as pg
import time as t
import math as m
import random as r
import os # this efficiently imports the necessary modules
pg.init()
screen = pg.display.set_mode((500, 500))
pg.display.set_caption("bullet hell")
clock = pg.time.Clock()
clock.tick(60)
player = pg.image.load("player.png")
def loopkill():
if event.type == pg.QUIT:
running = False
def loop(): # this is the mainloop for pygame
running = True
while running:
for event in pg.event.get():
t.sleep(100)
if event.type == pg.QUIT:
running = False
if event.type == pg.KEYDOWN:
print("ready")
pg.surface.blit(player, (250, 250))
g.draw(screen)
g.update()
pg.display.flip()
# Quit Pygame
pg.quit()
loop()
Expected a player sprite, however got a blank screen instead.