Bottom Page

• 4 Vote(s) - 3.25 Average
• 1
• 2
• 3
• 4
• 5
 Pygame Error Ditrate40 Programmer named Tim Posts: 6 Threads: 2 Joined: Dec 2018 Reputation: 0 Likes received: 0 #1 Jan-12-2019, 06:42 PM (This post was last modified: Jan-12-2019, 11:05 PM by metulburr. Edited 1 time in total. Edit Reason: added code tags ) Hi, here is my code : ```import pygame pygame.init() screen = pygame.display.set_mode((1000,750)) vie = True clock = pygame.time.Clock() x = 50 y = 50 points_x = [500] points_y = [375] clock = pygame.time.Clock() color = (255, 100, 0) def mouvement(): screen.fill((0, 0, 0)) for loop in range(len(points_x) - 1): points_x[len(points_x) - loop] = points_x[len(points_x) - loop - 1] points_y[len(points_y) - loop] = points_y[len(points_y) - loop - 1] for loop in range(len(points_x)): pygame.draw.rect(screen, color, pygame.Rect(points_x[loop], points_y[loop], 60, 60)) while True: pressed = pygame.key.get_pressed() ancien_x = points_x[0] ancien_y = points_y[0] if pressed[pygame.K_UP]: points_y[0] -= 3 mouvement() elif pressed[pygame.K_DOWN]: points_y[0] += 3 mouvement() elif pressed[pygame.K_LEFT]: points_x[0] -= 3 mouvement() elif pressed[pygame.K_RIGHT]: points_x[0] += 3 mouvement() pygame.draw.rect(screen, color, pygame.Rect(x, y, 60, 60)) clock.tick(60) ``` But, the screen don't show anything. I don't know why ... metulburr Hobbyist Posts: 3,852 Threads: 241 Joined: Sep 2016 Reputation: 101 Likes received: 972 #2 Jan-12-2019, 11:07 PM after clock.tick(60) add the following line `pygame.display.update()`This needs to be done once ever in the main game loop. Recommended Tutorials: BBcode, Forum Rules and Instructions, How to ask smart questions, the Basics, Classes, Python Gotchas « Next Oldest | Next Newest »

Top Page

Forum Jump:

Users browsing this thread: 1 Guest(s)