-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path2048.py
More file actions
33 lines (29 loc) · 959 Bytes
/
2048.py
File metadata and controls
33 lines (29 loc) · 959 Bytes
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
32
33
import functions
import pygame
blokje = [[None,None,None,None],
[None,None,None,None],
[None,None,None,None],
[None,None,None,None]]
#main game loop
blokje = functions.generateNewBlock(blokje)
blokje = functions.generateNewBlock(blokje)
running = True
while running:
for event in pygame.event.get():
if event.type == pygame.QUIT:
running = False
elif event.type == pygame.KEYDOWN:
if event.key == pygame.K_UP:
blokje = functions.goup(blokje)
elif event.key == pygame.K_DOWN:
blokje = functions.godown(blokje)
elif event.key == pygame.K_LEFT:
blokje = functions.goleft(blokje)
elif event.key == pygame.K_RIGHT:
blokje = functions.goright(blokje)
functions.renderbg()
for y in range(4):
for x in range(4):
blokje = functions.render(x, y, blokje)
pygame.display.flip()
pygame.quit()