64 lines
1.1 KiB
Python
64 lines
1.1 KiB
Python
import abc
|
|
|
|
|
|
class GameObject(abc.ABC):
|
|
|
|
def __init__(self, active, x, y, w, h):
|
|
self._active = active
|
|
self._x = x
|
|
self._y = y
|
|
self._width = w
|
|
self._height = h
|
|
|
|
@property
|
|
def active(self):
|
|
return self._active
|
|
|
|
@active.setter
|
|
def active(self, active: bool):
|
|
self._active = active
|
|
|
|
@property
|
|
def x(self):
|
|
return self._x
|
|
|
|
@x.setter
|
|
def x(self, coord_x):
|
|
self._x = coord_x
|
|
|
|
@property
|
|
def y(self):
|
|
return self._y
|
|
|
|
@y.setter
|
|
def y(self, coord_y):
|
|
self._y = coord_y
|
|
|
|
@property
|
|
def width(self):
|
|
return self._width
|
|
|
|
@width.setter
|
|
def width(self, width):
|
|
self._width = width
|
|
|
|
@property
|
|
def height(self):
|
|
return self._height
|
|
|
|
@height.setter
|
|
def height(self, height):
|
|
self._height = height
|
|
|
|
@abc.abstractmethod
|
|
def update(self, deltatime):
|
|
if not self._active:
|
|
return
|
|
pass
|
|
|
|
@abc.abstractmethod
|
|
def draw(self):
|
|
if not self.active:
|
|
return
|
|
pass
|