Skip to content
This repository was archived by the owner on Feb 17, 2023. It is now read-only.

LNX-64 Bmp map parsing #11

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

LNX-64 Bmp map parsing #11

wants to merge 1 commit into from

Conversation

EasyJB
Copy link
Member

@EasyJB EasyJB commented Jan 18, 2023

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

Copy link
Contributor

@blazej-smorawski blazej-smorawski left a 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"]
Copy link
Contributor

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

Copy link
Member

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 🥰

Copy link
Contributor

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)",
Copy link
Contributor

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?

@blazej-smorawski
Copy link
Contributor

Additionally, it would be nice if we could support multiple files per one map, so we could stack objects on on another.

Copy link
Contributor

@alpinus4 alpinus4 left a 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:
Copy link
Contributor

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

Copy link
Member

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
Copy link
Member

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
Copy link
Member

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 @@
{
Copy link
Member

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:
Copy link
Member

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):
Copy link
Member

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.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants