1
0
Fork 0
python-roguelike/entity.py

18 lines
416 B
Python
Raw Normal View History

2022-01-06 11:19:56 -05:00
from typing import Tuple
class Entity:
"""
A generic object to represent players, enemies, items, etc.
"""
def __init__(self, x: int, y: int, char: str, color: Tuple[int, int, int]):
self.x = x
self.y = y
self.char = char
self.color = color
def move(self, dx: int, dy: int):
# Move the entity by a given amount
self.x += dx
self.y += dy