import random
from game import constants
from game.actor import Actor
from game.point import Point

class Food(Actor):
    def __init__(self):
        self._points = 0
        self.constants = constants
        self.actor = Actor
        self.point = Point
        
        #sets the first position of food
        rand_x = random.randint(0, self.constants.MAX_X)
        rand_y = random.randint(0, self.constants.MAX_Y)
        point = self.point(rand_x, rand_y)
        super().set_position(point)

        self._points = random.randint(1, 5)

        self.constructor()

    def constructor(self):
        super().set_text('@')


    def reset(self):
        self._points = random.randint(1, 5)
        rand_x = random.randint(2, self.constants.MAX_X)
        rand_y = random.randint(2, self.constants.MAX_Y)
        point = self.point(rand_x, rand_y)
        super().set_position(point)
    
    def get_points(self):
        return(self._points)


