Im trying to make some Minecraft 2d clone in pygame, and I want it to blit an image at the position of the cursor when I left click, but when I test the game and left click, the image appears and disappears shortly.
Here is the code:
import pygame
# Setup
pygame.init()
screen = pygame.display.set_mode((1080,720))
pygame.display.set_caption('2d minecraft')
clock = pygame.time.Clock()
logo = pygame.image.load("logo.png")
pygame.display.set_icon(logo)
# Variables
running = True
dirt = pygame.image.load("logo.png")
# Program
while running:
# Customization
screen.fill((110,150,200))
# Update display
pygame.display.update()
# Events
for event in pygame.event.get():
if event.type == pygame.MOUSEBUTTONUP:
screen.blit(dirt, (pygame.mouse.get_pos()))
if event.type == pygame.QUIT:
running = False
pygame.display.flip()
clock.tick(30)