this my first time on Stacks overflow, first of all, so plz do not kill me if I format wrong, but I am trying to run this code, but every time I do the Pygame screen just turns black, and every time my cursor goes on top of the screen, it becomes one of the spinning donuts, that mean that windows is having a hard time processing. If anyone could please help me, figure out what is wrong, I would greatly appreciate it, thx in advance by the way.
Here is the code:
import pygame
pygame.init()
ss_images = [
pygame.transform.scale(pygame.image.load('C:/Users\\Wonka101\\PycharmProjects\\Images\\ss1.png'), (64, 64)),
pygame.transform.scale(pygame.image.load('C:/Users\\Wonka101\\PycharmProjects\\Images\\ss2.png'), (64, 64))
]
screen = (500, 500)
bg = pygame.image.load('C:/Users\\Wonka101\\PycharmProjects\\Images\\space v.2.jpg')
bg = pygame.transform.scale(bg, screen)
win = pygame.display.set_mode(screen)
clock = pygame.time.Clock()
class Player(object):
def __init__(self, x_position, y_position, width, height):
self.x_position = x_position
self.y_position = y_position
self.width = width
self.height = height
self.velocity = 5
self.left = False
self.right = False
self.fly_count = 0
def draw(self):
while True:
win.blit(ss_images[self.fly_count], (self.x_position, self.y_position))
self.fly_count = self.fly_count + 1
if self.fly_count == 2:
self.fly_count = 0
def game_window():
global fly_count
win.blit(bg, (0, 0))
ss.draw()
pygame.display.update()
ss = Player(250, 250, 64, 64)
running = True
while running:
pygame.time.delay(100)
clock.tick(60)
for event in pygame.event.get():
if event.type == pygame.QUIT:
running = False
game_window()