forked from raulc03/Ubongo
-
Notifications
You must be signed in to change notification settings - Fork 0
/
tablero
70 lines (49 loc) · 1.67 KB
/
tablero
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
import sys
import random
import pygame
class gema:
def __init__(self, a, b, e):
self.x = a
self.y = b
self.h = 50
self.w = 50
if e == 1:
self.color = (255, 0, 0)
elif e == 2:
self.color = (0, 0, 255)
elif e == 3:
self.color = (52, 234, 17)
elif e == 4:
self.color = (255, 255, 0)
elif e == 5:
self.color = (255, 147, 0)
elif e == 6:
self.color = (183, 0, 255)
def drawTablero(dimensiones, pantalla):
an = dimensiones[0] / 16
la = dimensiones[1] / 6
pygame.draw.rect(pantalla, (248, 190, 38), [0, 0, dimensiones[0], dimensiones[1]])
pygame.draw.rect(pantalla, (128, 128, 0), [12 * (an), 0, dimensiones[0] - (an), dimensiones[1]])
for y in range(0, 6):
pygame.draw.line(pantalla, (92, 38, 7), (0, y * (la)), (dimensiones[0] - 1, y * (la)), 2)
for x in range(1, 13):
pygame.draw.line(pantalla, (92, 38, 7), (x * (an), 0), (x * (an), dimensiones[1] - 1), 2)
pygame.init()
dimensiones = [1500, 600]
an = dimensiones[0] / 16
la = dimensiones[1] / 6
pantalla = pygame.display.set_mode(dimensiones)
pygame.display.set_caption("TABLERO")
drawTablero(dimensiones, pantalla)
gemas = []
for x in range(0, 12):
for y in range(0, 6):
gemas.append(gema(x * an, y * la, random.randint(1, 6)))
for j in range(len(gemas)):
pygame.draw.ellipse(pantalla, gemas[j].color, [gemas[j].x + an/4 , gemas[j].y + la/4, gemas[j].w, gemas[j].h])
while True:
for event in pygame.event.get():
if event.type == pygame.QUIT:
pygame.quit()
sys.exit()
pygame.display.update()