Jun-19-2018, 02:00 PM
Hi, I am a new programmer. My red cube is not moving
import pygame import time import random import sys pygame.init() #screen variables sWidth = 1000 sHeight = 700 #colours red = (255,0,0) black = (0,0,0) white = (255,255,255) #Main mechanics gDisplay = pygame.display.set_mode((sWidth,sHeight)) clock = pygame.time.Clock() pygame.display.set_caption('Zube') def gameStart(): #Mechanics gDisplay.fill(white) pygame.display.update() clock.tick(60) #Shapes and stuff playerStartingx = 64 playerStartingy = sHeight - 100 player = pygame.draw.rect(gDisplay, red, (playerStartingx,playerStartingy, 60, 60), 0) LRC = 0 pygame.display.update() #Game Loop Variable playing = True while playing: for event in pygame.event.get(): if event.type == pygame.QUIT: pygame.quit() quit() if event.type == pygame.KEYDOWN: if event.key == pygame.K_LEFT: LRC = -50 elif event.key == pygame.K_RIGHT: LRC = 50 if event.type == pygame.KEYUP: if event.key == pygame.K_LEFT or event.key == pygame.K_RIGHT: LRC = 0 playerStartingx += LRC gameStart()