-
Notifications
You must be signed in to change notification settings - Fork 0
/
make_a_map.py
70 lines (45 loc) · 1.66 KB
/
make_a_map.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
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
"""
Rohan Shah
Click to place pushpin on map
"""
import pygame
from pygame.locals import *
print("\n\nDIRECTIONS")
print("Click to place pushpin")
pygame.init()
screen = pygame.display.set_mode((400, 400), 0, 32)
def draw_road(startX, startY, endX, endY):
pygame.draw.line(screen, (142, 137, 131), (startX, startY), (endX, endY), 4)
def draw_river(centerX, centerY, width, height):
pygame.draw.ellipse(screen, (65, 105, 225), (centerX - width//2, centerY - height//2, width, height))
pygame.draw.ellipse(screen,(144, 238, 144), (centerX - (width-30)//2, centerY - (height-30)//2, width-30, height-30))
screen.fill((144, 238, 144))
pygame.draw.ellipse(screen, (65, 105, 225), (10-50, 300-150//2, 100, 150))
draw_river(400, 0, 450, 320)
draw_river(400, 400, 350, 350)
draw_road(35, 110, 100, 110)
draw_road(100, 110, 100, 265)
draw_road(100, 110, 155, 170)
draw_road(155, 170, 345, 170)
draw_road(345, 170, 405, 205)
draw_road(35, 110, 35, 35)
draw_road(0, 35, 220, 35)
draw_road(220, 35, 255, -5)
draw_road(-5, 180, 185, 335)
draw_road(185, 335, 405, 335)
draw_road(100, 265, 60, 360)
draw_road(60, 360, 60, 405)
draw_road(295, 405, 295, 80)
draw_road(295, 80, 220, 35)
draw_road(295, 80, 405, 80)
while True:
# royal blue 65, 105, 225
for event in pygame.event.get():
if event.type == QUIT:
pygame.quit()
if event.type == MOUSEBUTTONDOWN:
pos = pygame.mouse.get_pos()
pygame.draw.circle(screen, (0,0,0), pos, 2)
pygame.draw.line(screen, (0,0,0), pos, (pos[0], pos[1]-20))
pygame.draw.circle(screen, (220, 20, 60), (pos[0], pos[1]-20), 5)
pygame.display.update()