engine.editor_container documentation - wladekpal/The-Lazy-Snek GitHub Wiki
engine.editor_container.EditorContainer
Class that contains data of currently created level. It provides functions to modify state of board, snakes and available blocks.
Properties
name
- level namecreator
- level creatordimensions
- integer pair holding board size informationboard
-board.Board
object, created boardadditional_data
- matrix of dictionaries, holding additional data for each fieldblock_placement_stack_matrix
- matrix of id stacks. Stack represents objects placed on board on same coordinates from lowest (Field) to highest (snakes, blocks). First element is always 0snakes
- list of created snakesavailable_blocks
- list of available blocks added to leveltags
- list of tagsactive_snake
- snake that is in the process of being created, None if there is no such snakechosen_teleport
- teleport that player chose as end teleport, so that begin teleports can be linked to it. None if no end teleport is selected.
constructor
Constructor method takes dimensions, name and level creator.
create_entity_filled_board(dimensions, entity_constructor)
Creates matrix with given dimensions, containing object created by given constructor.
try_placing_entity(entity_id, position)
Places entity determined by entity_id on given position.
remove_snake(snake)
Removes given snake.
remove_all_connected_fields(coordinates)
Removes all Fields that are connected to Field on given coordinates.
remove_highest_entity(position)
Removes highest object on given position. For example, if there is Field, and there is block on field, the block is removed.
add_available_block(block_id)
Adds block determined by id to available blocks.
get_block_placement()
Creates matrix of ids, so the list properly describes board.
get_snake_data()
Creates list of dictionaries that describes snakes added to level.
check_snake_new_block(field, snake)
Checks if new snake segment placed on field would properly extend currently created snake. If so, snake is being extended.
try_placing_snake()
Function handles placing one snake segment.
finish_snake_building()
Sets active_snake to None, removes currently created snake if it's length is 1.
finish_teleport_linking()
Sets chosen_teleport to None.
rotate_snake_head(position)
Rotates head of snake that is placed on given position.
change_snake_color(position)
Changes color of snake that is place on given position.
link_teleport(position)
Links BeginTeleport on given position to EndTeleport determined by chosen_teleport.
convert_level_to_dictionary()
Converts level to dictionary describing it according to level representation.
get_available_blocks()
Returns list of available blocks.
self_draw(frame)
Draws board in given frame.