Skip to content

Commit f8485b9

Browse files
committed
Added Areas to object and 1.5
1 parent c05f1ae commit f8485b9

2 files changed

Lines changed: 11 additions & 2 deletions

File tree

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ name = "scrap_engine"
77
authors = [{ name = "lxgr", email = "lxgr@protonmail.com" }]
88
description = "A 2D ascii game engine for the terminal"
99
keywords = ["game", "Ascii"]
10-
version = "1.4.9"
10+
version = "1.5.0"
1111
license = { text = "GPL-3.0-only" }
1212
readme = "README.md"
1313
requires-python = ">=3.13"

src/scrap_engine/addable/object.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
from ..error import CoordinateError
22
from ..map.map import Map
33
from .addable import Addable
4+
from .area import HasArea
45
from .state import DEFAULT_STATE, State
56

67

7-
class Object(Addable):
8+
class Object(HasArea, Addable):
89
"""
910
An object, containing a character, that can be added to a map.
1011
"""
@@ -72,6 +73,14 @@ def redraw(self):
7273
self.map.map[self.y][self.x] = self.char
7374
return 0
7475

76+
@property
77+
def height(self) -> int:
78+
return 1
79+
80+
@property
81+
def width(self) -> int:
82+
return 1
83+
7584
def __backup_setter(self):
7685
if (
7786
len(self.map.obmap[self.y][self.x])

0 commit comments

Comments
 (0)