repl.it
@Deacon_Cronin/

Gayme Jam

Pygame

No description

fork
loading
Files
  • main.py
  • nohup.out
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
import pygame
pygame.init()
display_width = 800
display_height = 600
black = (0,0,0)
white = (255,255,255)
blue = (0,0,128)
purple = (178,0,255)
pink = (255,0,128)
back = (143,67,7)
front = (251,181,33)
x = display_width / 2
y = display_height /2
x_change = display_width / 20
y_change = display_height / 20
screen = pygame.display.set_mode((display_width,display_height))
run = True
while run:
  pygame.time.delay(100)
  for event in pygame.event.get():
    if event.type == pygame.QUIT:
      run = False
    if event.type == pygame.KEYDOWN:
      if event.key == pygame.K_LEFT:
        x -= x_change
      if event.key == pygame.K_RIGHT:
        x += x_change
  screen.fill(black)
  pygame.draw.rect(screen, front, (x,y,25,25))
  pygame.display.update()
?