2021-06-19 00:09:14 +02:00
|
|
|
from survival.game.enums import Direction
|
2021-04-19 00:07:40 +02:00
|
|
|
|
|
|
|
|
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)
|