-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathobject.py
More file actions
144 lines (121 loc) · 4.6 KB
/
object.py
File metadata and controls
144 lines (121 loc) · 4.6 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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
import os
from colorama import Fore, Back
import config
class scenery:
def create_ground(self, grid):
for i in range(400):
grid[config.rows-3][i] = Fore.GREEN + "T" + Fore.RESET
grid[config.rows-2][i] = Fore.GREEN + Back.GREEN + "T" + Fore.RESET + Back.RESET
def create_sky(self, grid):
for i in range(400):
grid[1][i] = Fore.CYAN + Back.CYAN + "X" + Fore.RESET + Back.RESET
grid[2][i] = Fore.CYAN + "X" + Fore.RESET
class object:
def __init__(self, x, y, height, width):
self._x = x
self._y = y
self._height = height
self._width= width
self._shape = []
def get_shape(self):
return self._shape
def get_objpos(self):
return [self._x, self._y]
def get_objdim(self):
return [self._height, self._width]
class cloud(object):
def __init__(self, x, y, height, width):
super().__init__(x, y, height, width)
self._height = 3
self._width= 6
self._shape = [
[" ", "(", "-", "-", ")", " "],
["(", "-", "~", "-", "~", ")"],
[" ", "(", "-", "-", ")", " "]
]
for i in range(self._height):
for j in range(self._width):
self._shape[i][j] = Fore.BLUE + self._shape[i][j] + Fore.RESET
class coin1(object):
def __init__(self, x, y, height, width):
super().__init__(x, y, height, width)
self._height = 2
self._width= 3
self._shape = [
["$", "$", "$"],
["$", "$", "$"],
]
for i in range(self._height):
for j in range(self._width):
self._shape[i][j] = Fore.YELLOW + self._shape[i][j] + Fore.RESET
class beam_horizontal(object):
def __init__(self, x, y, height, width):
super().__init__(x, y, height, width)
self._height = 1
self._width= 3
self._shape = [
["#", "#", "#"],
]
for i in range(self._height):
for j in range(self._width):
self._shape[i][j] = Fore.BLUE + Back.RED + self._shape[i][j] + Fore.RESET + Back.RESET
class beam_vertical(object):
def __init__(self, x, y, height, width):
super().__init__(x, y, height, width)
self._height = 3
self._width= 1
self._shape = [
["#"],
["#"],
["#"]
]
for i in range(self._height):
for j in range(self._width):
self._shape[i][j] = Fore.BLUE + Back.RED + self._shape[i][j] + Fore.RESET + Back.RESET
class beam_diagonal(object):
def __init__(self, x, y, height, width):
super().__init__(x, y, height, width)
self._height = 3
self._width= 3
self._shape = [
["#", " ", " "],
[" ", "#", " "],
[" ", " ", "#"],
]
for i in range(self._height):
for j in range(self._width):
if(self._shape[i][j] == "#"):
self._shape[i][j] = Fore.BLUE + Back.RED + self._shape[i][j] + Fore.RESET + Back.RESET
class magnet(object):
def __init__(self, x, y, height, width):
super().__init__(x, y, height, width)
self._height = 5
self._width= 3
self._shape = [
[" ", "___", " "],
[" ", "___", " "],
["/ /", " ", "\\ \\"],
["| |", " ", "| |"],
["| |", " ", "| |"],
]
self._shape[4][0] = Fore.RED + Back.RED + self._shape[4][0] + Fore.RESET + Back.RESET
self._shape[4][2] = Fore.BLUE + Back. BLUE + self._shape[4][2] + Fore.RESET + Back.RESET
for i in range(self._height):
for j in range(self._width):
if(i != 4 and j != 0 or i != 4 and j != 2 or self._shape[i][j] != " "):
self._shape[i][j] = Fore.WHITE + self._shape[i][j] + Fore.RESET
# class speed_boost(object):
# def __init__(self, x, y, height, width):
# super().__init__(x, y, height, width)
# self._height = 3
# self._width= 3
# self._shape = [
# ["-", "----", "-"],
# ["-", ">>>>", "-"],
# ["-", "----", "-"]
# ]
# self._shape[1][1] = Fore.YELLOW + Back.BLACK + self._shape[1][1] + Fore.RESET + Back.RESET
# for i in range(self._height):
# for j in range(self._width):
# if(self._shape[i][j] != Fore.YELLOW + Back.BLACK + ">>>>" + Fore.RESET + Back.RESET):
# self._shape[i][j] = Fore.RED + Back.RED + self._shape[i][j] + Fore.RESET + Back.RESET