-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlevels.py
More file actions
83 lines (72 loc) · 2.67 KB
/
levels.py
File metadata and controls
83 lines (72 loc) · 2.67 KB
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
71
72
73
74
75
76
77
78
79
80
81
82
83
class Level:
"""Represents a level in the game."""
def __init__(self, name, points, rectangles, end_rect):
self.name = name
self.points = points
self.rectangles = rectangles
self.end_rect = end_rect
def level1(window_width, window_height, line_length) -> Level:
points = [
(25, window_height - 20),
(20, window_height - 20 - line_length)
]
rectangles = [
(200, window_height - 300, 100, 100)
]
end_rect = (window_width - 100, 0, 100, 100)
return Level("Level 1", points, rectangles, end_rect)
def level2(window_width, window_height, line_length) -> Level:
points = [
(25, window_height - 20),
(20, window_height - 20 - line_length)
]
rectangles = [
(window_width - 500, window_height - 100, 200, 100),
(window_width - 300, window_height - 150, 200, 150),
(window_width - 100, window_height - 200, 100, 200),
(0, 0, window_width, window_height - 300),
]
end_rect = (window_width - 100, window_height - 300, 100, 100)
return Level("Level 2", points, rectangles, end_rect)
def level3(window_width, window_height, line_length) -> Level:
points = [
(100, window_height - 20),
(100 + line_length, window_height - 20)
]
rectangles = [
(0, 0, 50, window_height),
(window_width - 50, 0, 50, window_height),
(50, window_height - 200, 400, 25),
(300, 100, 400, 25),
]
end_rect = (window_width - 150, 0, 100, 100)
return Level("Level 3", points, rectangles, end_rect)
def level4(window_width, window_height, line_length) -> Level:
points = [
(30, window_height - 20),
(30 + line_length, window_height - 20)
]
rectangles = [
(0, 0, 5, window_height),
(5, 0, window_width - 5, 5),
(150, 135, window_width - 150, window_height - 135),
]
end_rect = (window_width - 100, 5, 100, 130)
return Level("Level 4", points, rectangles, end_rect)
def level5(window_width, window_height, line_length) -> Level:
points = [
(25, window_height - 20),
(20, window_height - 20 - line_length)
]
rectangles = [
(0, 0, 100, window_height - 150),
(100, 0, 100, window_height - 250),
(200, window_height - 100, 100, 100),
(200, 0, 100, window_height - 350),
(300, window_height - 200, 100, 200),
(300, 0, window_width - 300, window_height - 450),
(400, window_height - 300, 100, 300),
(500, window_height - 350, window_width - 500, 350),
]
end_rect = (window_width - 100, window_height - 450, 100, 100)
return Level("Level 5", points, rectangles, end_rect)