from turtle import Turtle
import random

class Food:
    def __init__(self, screen_x_size, screen_y_size):
        self.turtle = Turtle(shape="square")
        self.turtle.color("cyan")
        self.turtle.pu()

        x_limit = int((screen_x_size-20)/40)
        y_limit = int((screen_y_size-20)/40)

        x_pos = random.randint(-x_limit, x_limit)*20
        y_pos = random.randint(-y_limit, y_limit)*20
        self.turtle.teleport(x=x_pos, y=y_pos)

    
    def get_position(self):
        return self.turtle.xcor(), self.turtle.ycor()
    
    def hide(self):
        self.turtle.hideturtle()