Mind.Orientation¶
Classes, methods and functions marked with * aren’t for usual cases, they are made to help to the rest of the library.
-
exception
Mind.Orientation.
MapError
(x, y, max_x, max_y)[source]¶ Exception for points outside the map.*
-
class
Mind.Orientation.
point
(x, y, Map, description='Unknown', quiet=False)[source]¶ Basic point class.
-
class
Mind.Orientation.
line
(points, Map, description='Unknown', quiet=False, from_line_seg=False)[source]¶ Basic line class.
-
class
Mind.Orientation.
line_seg
(points, Map, description='Unknown', quiet=False, from_line=False)[source]¶ Basic line segment class.
-
class
Mind.Orientation.
ray
(start_p, some_p, Map, description='Unknown', quiet=False)[source]¶ Basic ray class.
-
class
Mind.Orientation.
direction
(point, angle, Map, description='Unknown', quiet=False)[source]¶ Basic direction class.
-
class
Mind.Orientation.
group_of_points
(Map, description='Unknown', *points, quiet=False)[source]¶ Class for group of points.
-
class
Mind.Orientation.
rect
(x, y, width, height, Map, description='Unknown', quiet=False)[source]¶ Basic map rect class.
-
class
Mind.Orientation.
circle
(centre, radius, Map, description='Unknown', quiet=False)[source]¶ Basic circle class.
-
class
Mind.Orientation.
layer
(name, props, mapping, Map)[source]¶ Basic tilemap layer (Tile Layer) class.*
-
class
Mind.Orientation.
map_obj
(name, Type, props, picture, Map, obj)[source]¶ Blitable tilemap object class.
-
class
Mind.Orientation.
Subject
(name, Type, props, picture, Map, obj)[source]¶ Basic centre tilemap object class (subclass of
map_obj
).
-
class
Mind.Orientation.
objectgroup
(name, props, objects, Map)[source]¶ Basic tilemap objectgroup (Object Layer) class.
-
class
Mind.Orientation.
visual_map
(x, y, layers=True, path='', decode=[{}, {}, {}], tilesize=(), images={}, else_=[<class 'Mind.Orientation.layer'>, <class 'Mind.Orientation.objectgroup'>, <class 'Mind.Orientation.Object'>], gid_point=True, gid_line=True, size_in_tiles=False)[source]¶ Basic class for game map.
Parameters: - x (int) – width of map
- y (int) – height of map
- layers (bool) – does map have layers
- path (str) – path to all map images
- decode (list of dicts) – decoding; first dict is for layers, second for objectgroup and third for object
- tilesize (tuple) – size of each tile (needed only if layers are used)
- images (dict) – dictionary containing images paths and their nickname (used in
write_on
) - else (list) – default decoding; first for layer, second for objectgroup, third for object
- gid_point (bool) – if
True
object’s obj will be point if rect doesn’t have width and height - gid_line (bool) – if
True
object’s obj will be line if rect doesn’t have width or height - size_in_tiles (bool) – is
x
andy
measured in tiles
-
set_camera_pos
(x, y, pos=(50, 50), edge=True)[source]¶ Sets camera position.
Parameters: - x (int) – x position of point
- y (int) – y position of point
- pos (tuple) – point of screen in percentage
- edge (bool) – if
True
won’t be outside the screen
-
get_camera_pos
(pos=(50, 50))[source]¶ Gets camera position.
Parameters: pos (tuple) – point of screen in percentage
-
create_objectgroup
(name, props={}, objects=[], **rest)[source]¶ Creates map’s objectgroup.
Parameters: - name (str) – objectgroup name
- props (dict) – properties of objectgroup
- objects (list) – objects that belong to objectgroup
- rest – other objectgroup parameters
-
load_objectgroup
(xml_obj)[source]¶ Loads objectgroup from xml element.*
Parameters: xml_obj – element from which objectgroup is loaded
-
assign_object
(objgroup, obj)[source]¶ Assigns object to particular objectgroup.*
Parameters: - objgroup (str) – name of the objectgroup
- obj – object which will be assigned
-
create_object
(objgroup, name, Type, props={}, obj=None, **rest)[source]¶ Creates map object and assigns it to particular objectgroup.
-
create_layer
(name, props={}, **rest)[source]¶ Creates map layer
Parameters: - name (str) – layer name
- props (dict) – layer properties
- rest – other layer parameters
-
load_layer
(xml_obj)[source]¶ Loads objectgroup from xml element.*
Parameters: xml_obj – element from which layer is loaded
-
create_tileset
(img, name)[source]¶ Creates map tileset.
Parameters: - img (str) – path to tileset image
- name (str) – tileset name
-
clone_obj
(key, key_type='name')[source]¶ Returns list of all objects with given parameter.
Parameters: - key (str) – parameter of searching object/s
- key_type (str) – name, group or type; what key means.
-
class
Mind.Orientation.
tiled_map
(name, decode=[{}, {}, {}], else_=[<class 'Mind.Orientation.layer'>, <class 'Mind.Orientation.objectgroup'>, <class 'Mind.Orientation.Object'>], gid_point=True, gid_line=True)[source]¶ Basic class for map in Tiled.
Parameters: - name (str) – file name
- decode (list of dicts) – decoding; first dict is for layers, second for objectgroup and third for object
- else (list) – default decoding; first for layer, second for objectgroup, third for object
- gid_point (bool) – if
True
object’s obj will be point if rect doesn’t have width and height - gid_line (bool) – if
True
object’s obj will be line if rect doesn’t have width or height
-
class
Mind.Orientation.
moving_map
(name, x, y, decode=[{}, {}, {}], else_=[<class 'Mind.Orientation.layer'>, <class 'Mind.Orientation.objectgroup'>, <class 'Mind.Orientation.Object'>], gid_point=True, gid_line=True)[source]¶ Subclass of
tiled_map
for easier moving.Parameters: - name (str) – file name
- x (int) – map centre object x
- y (int) – map centre object y
- decode (list of dicts) – decoding; first dict is for layers, second for objectgroup and third for object
- else (list) – default decoding; first for layer, second for objectgroup, third for object
- gid_point (bool) – if
True
object’s obj will be point if rect doesn’t have width and height - gid_line (bool) – if
True
object’s obj will be line if rect doesn’t have width or height
-
set_position
(x, y, pos=(50, 50), edge=True)[source]¶ Sets centre object position
Parameters: - x (int) – x position of centre object
- y (int) – y position of centre object
- pos (tuple) – point of screen in percentage
- edge (bool) – if
True
won’t be outside the screen
-
move
(hor, ver, pos=(50, 50), edge=True)[source]¶ Moves centre object.
Parameters: - hor (int) – horizontal movement (positive for right, negative for left)
- ver (int) – vertical movement (positive for down, negative for up)
- pos (tuple) – point of screen in percentage
- edge (bool) – if
True
won’t be outside the screen