engine.direction documentation - wladekpal/The-Lazy-Snek GitHub Wiki
engine.direction.Direction
Class represents the direction of movements of some object. There are 4 possible directions (north, east, south, west). Class provides interface for changing direction, as well as calculating coordinates in direction.
Properties
delta
- list informing how consecutive directions change coordinates.direction_name
- list containing possible direction names ('N', 'E', 'S', 'W').index
- Keeps current direction, by referencing index on both above lists.
constructor
Constructor method takes a string representing the initial direction. If non-existant direction is given ValueErorr
is raised.
str()
Returns letter describing currently selected direction.
move_in_direction(coords)
Takes a pair representing coordinates. Returns new pair representing given coordinates after move in selected direction.
turn_right(), turn_left(), reverse()
Changes selected direction accordingly.