So, I'm trying to make a game, and I'm working on the basics, I'm trying to figure out why is when I press the 0 key, it prints "a", but the image on the screen doesn't change. This is the same when pressing one too.
import pygame
from pygame.display import mode_ok
pygame.init()
size = width, height = 1000, 800
speed = [2, 2]
black = 1, 2, 0
screen = pygame.display.set_mode(size)
mode_ok(size, flags=1, depth=5, display=0)
DISPLAYSURF = pygame.display.set_mode((0, 0), pygame.FULLSCREEN)
pygame.display.set_caption('Game')
# image database
pic = pygame.image.load(r"intro_ball.gif")
pic2 = pygame.image.load("poeple.png")
pic3 = pygame.image.load("frame_04_delay-0.1s.gif")
pic4 = pygame.image.load("frame_17_delay-0.1s.gif")
screen.blit(pygame.transform.scale(pic, (1000, 800)), (0, 0))
screen.blit(pic2, (500, 400))
pygame.display.flip()
while True:
for event in pygame.event.get():
if event.type == pygame.QUIT:
pygame.quit()
if event.type == pygame.KEYDOWN:
if event.key == pygame.K_0:
screen.blit(pic3, (0, 0))
print("a")
if event.key == pygame.K_1:
screen.blit(pygame.transform.scale(pic4, (1000, 800)), (0, 0))
print("B")
pygame.event.pump()
If anyone can help, that would be greatly appreciated.