Hi there i am working on a side scrolling abckground to put in my game, heres what ive got at the moment:
import pygame
import sys
import pygame.sprite as sprite
theClock = pygame.time.Clock()
background = pygame.image.load('space.jpg')
background_size = background.get_size()
background_rect = background.get_rect()
screen = pygame.display.set_mode(background_size)
w,h = background_size
x = 0
y = 0
x1 = 0
y1 = -h
running = True
while running:
screen.blit(background,background_rect)
pygame.display.update()
for event in pygame.event.get():
if event.type == pygame.QUIT:
running = False
y1 += 5
y += 5
screen.blit(background,(y,x))
screen.blit(background,(y1,1))
if y > h:
y = -h
if y1 > h:
y1 = -h
pygame.display.update()
theClock.tick(25)
pygame.quit()
at the moment i am getting a flickering screen with the moving image going to the right and the original image stationary flickering over it any help would be greatly appreciated - as its for my a-level computing coursework a and have trying to implement a feature liket his into the game for ages.... again thanks for help