Prepping editor more...
All checks were successful
Build Dusk / build-linux (push) Successful in 39s
Build Dusk / build-psp (push) Successful in 1m6s

This commit is contained in:
2025-11-16 14:43:29 -06:00
parent cf59989167
commit 750e8840f0
10 changed files with 285 additions and 167 deletions

View File

@@ -1,36 +1,24 @@
from dusk.event import Event
MAP_WIDTH = 5
MAP_HEIGHT = 5
MAP_DEPTH = 3
class Map:
def __init__(self):
self._position = [0, 0, 0] # x, y, z
self.listeners = []
self.position = [0, 0, 0] # x, y, z
self.positionEvent = Event()
self.chunks = []
self.width = 5
self.height = 5
self.depth = 3
@property
def position(self):
return self._position
@position.setter
def position(self, value):
self._position = value
self.notifyPositionListeners()
def addPositionListener(self, listener):
self.listeners.append(listener)
def notifyPositionListeners(self):
for listener in self.listeners:
listener(self._position)
def moveTo(self, x, y, z):
self.position = [x, y, z]
self.positionEvent.invoke(self.position)
def moveRelative(self, x, y, z):
self.moveTo(
self._position[0] + x,
self._position[1] + y,
self._position[2] + z
self.position[0] + x,
self.position[1] + y,
self.position[2] + z
)
# Singleton instance