from vendors.pyCartoDb.cartodb import Cartodb
import random
import time
from vendors.pyCartoDb.cartodb_object import CartoDb_object

cartoPy = Cartodb('xabel')
all_table = cartoPy.at('lotr').open()


class Character:
    import_version = 21

    def __init__(self, options):
        self.name = options['name']
        self.hidden = True
        self.stopped = True
        if 'type' in options:
            self.type = options['type']
        else:
            self.type = 'character'
        self.setted_lon = options['lon']
        self.setted_lat = options['lat']
        self.curr_lon = self.setted_lon
        self.curr_lat = self.setted_lat
        self.head_lon = self.setted_lon
        self.head_lat = self.setted_lat
        self.heading_change = 0
        self.speed = [0, 0]
        self.db_object = CartoDb_object(cartoPy)

    def change_heading(self, options):