Pygame arka plan haraket etmiyor

Pygame ile oyun yaparken arka planı haraket ettirmek istiyorum. Super Mario tarzı bir haraket olması gerek ama uğraştığım halde olmuyor.


Yürüdüğüm zaman ekranın sonuna doğru gelince bu şekilde bir çıktı alıyorum. Ekran yenilenmiyor.

import pygame, time, os, sys
from sprites import *
from settings import *

#Main sheet

pygame.init()

class Windowset():
    global BACKGROUND
    def __init__(self):
        self.ScreenH = sH
        self.ScreenW = sW
        self.ScreenRes = (self.ScreenH,self.ScreenW)
        self.window = pygame.display.set_mode(self.ScreenRes)
        self.Name = ProgramName
        self.FrameText = pygame.display.set_caption(self.Name)

    def RenderWindow(self):
        global WALKcount,JUMP,WALKleft,WALKrigth,JUMPcount,stopcount,CamX,CamY

        Window.window.blit(BACKGROUND,(0-CamX,0-CamY))

        if WALKcount <= -10:
            WALKcount = 0
            
        elif WALKcount >= 10:
            WALKcount = 0

        if JUMP and WALKleft:
            WALKleft = False

        if JUMP and WALKrigth:
            WALKrigth = False

        if WALKleft:
            i = (WALKcount // 2) % len(leftanimation)
            Window.window.blit(leftanimation[i], (x-CamX, y))
            WALKcount += 1

        elif WALKrigth:
            i = (WALKcount // 2) % len(rigthanimation)
            Window.window.blit(rigthanimation[i], (x-CamX, y))
            WALKcount -= 1

        elif JUMP:
            i = (JUMPcount // 2) % len(jumpanimation)
            Window.window.blit(jumpanimation[i], (x-CamX, y))

        else:
            i = (stopcount // 7) % len(CHAR)
            Window.window.blit(CHAR[i], (x-CamX, y-CamY))
            stopcount += 1

        pygame.display.update()
        Window.window.fill((250,250,250))

class player():
    def __init__(self):
        self.CharH = CHARheigth
        self.CharW = CHARwidth
        self.speed = vel
        self.CoordinateX = x
        self.CoordinateY = y
        self.left = WALKleft
        self.rigth = WALKrigth
        self.Jump = JUMP
        self.jcount = JUMPcount
        self.wcount = WALKcount
        self.Stopcount = 1

Player = player()
Window = Windowset()
flag = True
while flag:
    print(WALKcount)


    clock = pygame.time.Clock()
    clock.tick(FPS)
    keys = pygame.key.get_pressed()

    for event in pygame.event.get():
        if event.type == pygame.QUIT:
            sys.exit(0)

    if (keys[pygame.K_LEFT] or keys[pygame.K_a]) and x > vel:
        x -= vel
        CamX -= vel
        WALKleft = True
        WALKrigth = False

    elif (keys[pygame.K_RIGHT] or keys[pygame.K_d]) and x < 1000000 - vel:
        x += vel
        CamX += vel
        WALKrigth = True
        WALKleft = False

    else:
        WALKleft = False
        WALKrigth = False
        WALKcount = 0

    if not JUMP:
        if keys[pygame.K_SPACE] or keys[pygame.K_w]:
            JUMP = True
            WALKrigth = False
            WALKleft = False
            WALKcount = 0

    else:
        if JUMPcount > -9:
            neg = 1
            if JUMPcount < 0:
                neg = -1
            y -= (JUMPcount ** 2) * 0.4 * neg
            JUMPcount -= 1
        else:
            JUMP = False
            JUMPcount = 9
            y = 515

    Window.RenderWindow()

değişkenler;

import pygame,os,sys,time,sprites
# Settings sheet
ProgramName = "Bahtsız Woodcutter"
sH = 800
sW= 600
JUMP = False
FPS = 60
vel = 5
JUMPcount = 9
WALKrigth = False
WALKleft = False
WALKcount = 0
a = (0, 0)
x = 48
y = 515
CHARwidth = 48
CHARheigth = 48
bg_x=0
bg_y=0
bg_rel_x = 0
stopcount = 1
CamX = 0
CamY = 0

Merhabalar,

Aşağıdaki oynatma listesini takip ederek sorunu çözebilirsin. Kullanılan assetler bile aynı.

https://www.youtube.com/watch?v=hE1NYduqzZY&list=PLHW0kiN0F6quuXGhkp3sd9XC3XpcZSFGB