21 lines
405 B
Python
21 lines
405 B
Python
from __future__ import annotations
|
|
|
|
from dataclasses import dataclass
|
|
|
|
|
|
@dataclass(slots=True)
|
|
class Entity:
|
|
x: int = 0
|
|
y: int = 0
|
|
name: str = "Entity"
|
|
sprite_key: str = "entity"
|
|
blocks_movement: bool = True
|
|
|
|
@property
|
|
def position(self) -> tuple[int, int]:
|
|
return self.x, self.y
|
|
|
|
def move(self, dx: int, dy: int) -> None:
|
|
self.x += dx
|
|
self.y += dy
|