So when i do movement only at one side, it works but once i finish them all, it doesn't work. I tried to switch the numbers, commands, but it was useless. I'm a begginer and my skills are not too good for this because I was using tutorials before. i wanted to do something by myself and not using tutorials for that so i decided to aska quiestion
import pygame
import sys
from pygame.locals import *
clock = pygame.time.Clock()
pygame.init()
pygame.display.set_caption("Neverout")
player = pygame.image.load("player.png")
green = (181, 231, 29)
WINDOW_SIZE = (800, 800)
screen = pygame.display.set_mode(WINDOW_SIZE, 0, 32)
player_pos = [385, 50]
up = False #So here I have my movement variables
down = False
right = False
left = False
while True:
screen.blit(player, player_pos)
#Here i check if my movement variable are true after I press them
if left is True:
player_pos[0] -= 5
if right is True:
player_pos[0] += 5
if up is True:
player_pos[1] -= 5
if down is True:
player_pos[1] += 5
for event in pygame.event.get():
#here i check if the button is pressed
if event.type == KEYDOWN:
if pygame.K_LEFT:
left = True
if pygame.K_RIGHT:
right = True
if pygame.K_UP:
up = True
if pygame.K_DOWN:
down = True
#Here I check if a button is not pressed
if event.type == KEYUP:
if pygame.K_LEFT:
left = False
if pygame.K_RIGHT:
right = False
if pygame.K_UP:
up = False
if pygame.K_DOWN:
down = False
#Checks for quiting the app
if event.type == QUIT:
pygame.quit()
sys.exit()
#No dates only updates
pygame.display.update()
screen.fill(green)
clock.tick(60)