Ron Kosova's Profile

About

 
Points: 32

Pages

Contact

 
ron.kosova@gmail.com

Ron Kosova
February 4, 2017 · Public

Anyone know PyGame? I need some help :(
I've been doing thenewboston pygame tutorial and I've come across a problem I can't solve:
My code:
import pygame

pygame.init()
white = (255, 255, 255)
black = (0, 0, 0)
red = (255, 0, 0)

gameDisplay = pygame.display.set_mode((800, 600))
pygame.display.set_caption('Slither')

gameExit = False

lead_x = 300
lead_y = 300
lead_x_change = 0
lead_y_change = 0

clock = pygame.time.Clock()

while not gameExit:
for event in pygame.event.get():
if event.type == pygame.QUIT:
gameExit = True
if event.type == pygame.KEYDOWN:
if event.key == pygame.K_d:
lead_x_change = +2
if event.key == pygame.K_a:
lead_x_change = -2
lead_x += lead_x_change
gameDisplay.fill(white)
pygame.draw.rect(gameDisplay, black, [lead_x, lead_y, 10, 10])
pygame.display.update()

clock.tick(100)

pygame.quit()
quit()

The problem is when I play it the square doesn't move unless I move my mouse around. Please help as it's really discouraging me :(

Ron Kosova
January 12, 2017 · Public

Started learning Python by watching your videos....
"I don't think she's 18" - Bucky Roberts 2014-
(Nice videos btw)

Ron Kosova
January 12, 2017 · Public

Ron Kosova  >>  Bucky Roberts
December 13, 2015 · Public

I'm very sorry


Ron Kosova
December 12, 2015 · Public

I think someone here should create a page about HTML5,CSS3 or JS noobs. So the new programmers (like me. im a noob ;() can share new and cool stuff

HTML5
835 Followers
thenewboston
1405 Followers
Python
329 Followers