-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDESIGN.txt
More file actions
269 lines (241 loc) · 6.04 KB
/
DESIGN.txt
File metadata and controls
269 lines (241 loc) · 6.04 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
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
class: Background
methods:
get_name
get_images
get_image
class: MinerNotFull
methods:
set_position
get_position
get_images
get_image
get_rate
set_resource_count
get_resource_count
get_resource_limit
get_name
get_animation_rate
remove_pending_action
add_pending_action
get_pending_action
clear_pending_actions
next_image
entity_string
miner_to_ore
miner_to_smith
create_miner_action
try_transform_miner_not_full
try_transform_miner
create_animation_action
remove_entity
class: MinerFull
methods:
set_position
get_position
get_images
get_image
get_rate
set_resource_count
get_resource_count
get_resource_limit
get_name
get_animation_rate
remove_pending_action
add_pending_action
get_pending_action
clear_pending_actions
next_image
entity_string
miner_to_ore
miner_to_smith
create_miner_action
try_transform_miner_full
try_transform_miner
create_animation_action
remove_entity
class: Vein
methods:
set_position
get_position
get_images
get_image
get_rate
get_resource_distance
get_name
remove_pending_action
add_pending_action
get_pending_action
clear_pending_actions
next_image
entity_string
create_vein_action
create_animation_action
remove_entity
class: Ore
methods:
set_position
get_position
get_images
get_image
get_rate
get_name
remove_pending_action
add_pending_action
get_pending_action
clear_pending_actions
next_image
entity_string
create_animation_action
remove_entity
create_ore_transform_action
class: Blacksmith
methods:
set_position
get_position
get_images
get_image
get_rate
set_resource_count
get_resource_count
get_resource_limit
get_resource_distance
get_name
remove_pending_action
add_pending_action
get_pending_action
clear_pending_actions
next_image
entity_string
create_animation_action
remove_entity
class: Obstacle
methods:
set_position
get_position
get_images
get_image
get_name
next_image
entity_string
class: OreBlob
methods:
set_position
get_position
get_images
get_image
get_name
get_animation_rate
remove_pending_action
add_pending_action
get_pending_actions
clear_pending_actions
next_image
entity_string
blob_to_vein
create_ore_blob_action
create_animation_action
remove_entity
class: Quake
methods:
set_position
get_position
get_images
get_image
get_name
get_animation_rate
remove_pending_action
add_pending_action
get_pending_actions
clear_pending_actions
next_image
entity_string
create_animation_action
create_entity_death_action
remove_entity
class: Grid
methods:
set_cell
get_cell
class: OrderedList
methods:
insert
remove
head
pop
class: ListItem
no methods (just init and eq)
class: WorldModel
methods:
within_bounds
is_occupied
find_nearest
add_entity
move_entity
remove_entity
remove_entity_at
scheudle_action
unschedule_action
update_on_time
get_background_image
get_background
set_background
get_tile_occupant
get_entities
schedule_entity
class: WorldView
methods:
draw_background
draw_entities
draw_viewport
update_view
update_view_tiles
update_tile
get_tile_image
create_mouse_surface
update_mouse_cursor
mouse_move
FUNCTIONS:
actions.py:
next_postion, blob_next_position, find_open_around
These functions help methods from classes in the entities.py file.
While they help those methods, they are not really a behavior of the entity.
create_blob, create_ore, create_quake, create_vein, clear_pending_actions
These functions create the entities, so it wouldn't really need to be made into a method.
schedule_blob, schedule_miner, schedule_ore, schedule_quake, schedule_vein, schedule_action, schedule_animation
These functions schedule actions that the entities do, but they aren't really actions themselves. They are pretty much helper functions
clear_pending_actions
it calls the entity's clear_pending_
builder.py
create_default_background, main
There was no logical place to put these functions
builder_controller.py
save_world, load_world
Since these functions deal with writing / reading from another file, it makes sense to keep it separate from Classes
mouse_to_tile, on_keydown, handle_mouse_motion, handle_keydown, create_new_entity, is_background_tile, handle_moouse_button
There was no logical place to put these functions. They deal with control, so they should stay in the builder_controller.py file
activity_loop
It is used in setting up pygame and there is no logical place to put the function
controller.py
on_keydown, mouse_to_tile, handle_timer_event, hande_mouse_motion
handle_keydown
These functions deal with controlling the mouse, so it makes sense to keep it in the controller.py file.
It wouldn't make sense to put it in a class
activity_loop
It is used in setting up pygame and there is no logical place to put the function
save_load.py
save_world, save_entities, save_background, load_world
These functions deal with reading and writing from another file, so it makes sense to keep it where it is
add_background, add_entity, create_from_properties, create_miner, create_vein, create_ore, create_blacksmith, create_obstacle
These functions have no reasonable classes to go to
image_store.py
create_default_image, load_images, process_image_line, get_images_internal, get_images
These functions have no reasonable classes to go
worldmodel.py
nearest_entity, distance_sq
These functions are not really part of the World class, they are just helper functions
worldview.py
viewport_to_world, world_to_viewport, clamp, create_shifted_viewport
These functions are not really part of the View class, they are just helper functions
main.py
create_default_background, load_world, main
There is no place for these functions to go