console_snake/food.py

13 lines
288 B
Python
Raw Normal View History

2022-10-26 21:57:29 +03:00
from point import Point
from random import randint
from settings import *
class Food(Point):
def __init__(self, x, y):
2022-10-26 21:57:29 +03:00
Point.__init__(self, x, y)
def generate_new(self) -> None:
self.x = randint(0, WIDTH - 1)
self.y = randint(0, HEIGHT - 1)