-
Notifications
You must be signed in to change notification settings - Fork 0
LNX-64 Bmp map parsing #11
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, please rebase.
TrainingDummy(self, Point(1, 0)) | ||
with open(PATH_TO_CONFIG) as json_file: | ||
config = json.load(json_file) | ||
floor_colour = config["floor_colour"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I appreciate the British English spelling of word colour
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Superior American writing requires less less typing with the same clarity of the concept's meaning 🥰
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Gigachad ə(r)
vs virgin ər
@@ -0,0 +1,7 @@ | |||
{ | |||
"floor_colour": "(34, 177, 76)", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it necessary for floor
to be separate from the rest of the functions?
Additionally, it would be nice if we could support multiple files per one map, so we could stack objects on on another. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks good but i feel the logic should be moved to separate class
|
||
Portal(self, random.choice(points)) | ||
TrainingDummy(self, Point(1, 0)) | ||
with open(PATH_TO_CONFIG) as json_file: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could we move it to separate file and class?
so that we can could call here
BMPMap.load(self, "./src/maps/map1.bmp")
or something like that
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes please!
transitions==0.9.0 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We've switched to StateMachine
of @alpinus4, remove that line.
from src.common.point import Point | ||
from src.objects.agent import Agent | ||
from src.objects.floor import Floor | ||
from src.objects.portal import Portal | ||
from src.objects.object import Object | ||
from src.objects.npcs.enemies.training_dummy import TrainingDummy | ||
|
||
|
||
import json |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Group exports in accordance to PEP 8 Python standard.
https://peps.python.org/pep-0008/#imports
1. Standard library imports.
2. Related third party imports.
3. Local application/library specific imports.
Please use more blank lines, also.
@@ -0,0 +1,7 @@ | |||
{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rename to map_settings.json
or something more meaningful.
This is not really a Pythonic config.
|
||
Portal(self, random.choice(points)) | ||
TrainingDummy(self, Point(1, 0)) | ||
with open(PATH_TO_CONFIG) as json_file: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes please!
colour_to_function_dict.update(dict_row) | ||
map = Image.open("./src/maps/map1.bmp") | ||
image_width, image_height = map.size | ||
for width in range(image_width): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Divide into helper functions, 57-63 especially.
Added - basic Map parser. If you want to create example map, you need to use colours, as 3 numbers inside a tuple which are assigned to function, inside config.json. Remember to save map as BMP 24-bit