I am trying to remove the image when I click 1 key.
import pygame
import pygame.freetype
import random
# Intialise pygame
pygame.init()
pygame.font.init()
screen = pygame.display.set_mode((0, 0), pygame.FULLSCREEN) # Fullscreen
Cards
cards = (pygame.image.load('image/london.png'), pygame.image.load('image/america.png'))
def card():
screen.blit(card_size[0], (100, 40))
screen.blit(card_size[1], (330, 40))
Game loop
loop of the program starts here
running = True
while running:
screen.fill((255, 194, 102)) # RGB
for event in pygame.event.get(): # Event handler
if event.type == pygame.QUIT:
running = False
Here I have tried to remove item from the list but is didn't work.
if event.type == pygame.KEYDOWN:
if event.key == ord('1'):
cards.remove()
if event.key == ord('2'):
print('gone')
card()
pygame.display.update()