AI-Project/survival/components/position_component.py

16 lines
439 B
Python
Raw Permalink Normal View History

from survival.game.enums import Direction
2021-03-28 18:05:52 +02:00
class PositionComponent:
2021-04-19 17:20:40 +02:00
def __init__(self, pos, grid_pos, direction=Direction.DOWN):
2021-03-28 18:05:52 +02:00
self.position = pos
self.grid_position = grid_pos
2021-04-19 17:20:40 +02:00
self.direction = direction
self.direction_change_timer = 0
2021-04-19 01:41:02 +02:00
def rotate_left(self):
2021-04-19 12:05:33 +02:00
return Direction.rotate_left(self.direction)
2021-04-19 01:41:02 +02:00
def rotate_right(self):
2021-04-19 12:05:33 +02:00
return Direction.rotate_right(self.direction)