The code for my image in pygame:
img = pg.image.load(position[0][1].image).convert_alpha()
img = pg.transform.scale(img, (100, 100))
pg.display.update()
window.blit(img, (100, 0))
pg.display.update()
image: black knight png
For some reason my knight keeps flashing and doesn't work properly with my background, can someone help fix this. The PNG doesn't work for some reason.(it's not transparent with the background)
The pieces aren't loading with the board, the red squares keeps "clashing" with the pieces. chess board
The image is flashing because of the multiple calls to pg.display.update()
. Call pg.display.update()
only once at the end of the application loop:
img = pg.image.load(position[0][1].image).convert_alpha()
img = pg.transform.scale(img, (100, 100))
while True:
# [...]
window.blit(img, (100, 0))
pg.display.update()