lordmauve / wasabi2d

Cutting-edge 2D game framework for Python
https://wasabi2d.readthedocs.io/
GNU Lesser General Public License v3.0
154 stars 24 forks source link

Prevent assigning to immutable attributes like `.layer` #50

Open lordmauve opened 4 years ago

lordmauve commented 4 years ago

Assigning to layer succeeds but produces a layer failure:

Traceback (most recent call last):
  File "c:/Bookworm Adventures Monster Maker/MonsterMakerArcade.py", line 77, in <module>
    run()
  File "C:\Users\name\AppData\Local\Programs\Python\Python37\lib\site-packages\wasabi2d\game.py", line 175, in run
    updated |= self.dispatch_event(event)
  File "C:\Users\name\AppData\Local\Programs\Python\Python37\lib\site-packages\wasabi2d\game.py", line 158, in dispatch_event
    handler(event)
  File "C:\Users\name\AppData\Local\Programs\Python\Python37\lib\site-packages\wasabi2d\game.py", line 136, in new_handler
    return handler(**prepped)
  File "c:/Bookworm Adventures Monster Maker/MonsterMakerArcade.py", line 30, in on_mouse_move
    limb.checkIfSelected(position = pos, rel = rel)
  File "c:\Bookworm Adventures Monster Maker\Limb.py", line 13, in checkIfSelected
    self.selectionbox.pos += rel
  File "C:\Users\name\AppData\Local\Programs\Python\Python37\lib\site-packages\wasabi2d\primitives\base.py", line 61, in pos
    self._set_dirty()
  File "C:\Users\name\AppData\Local\Programs\Python\Python37\lib\site-packages\wasabi2d\primitives\base.py", line 174, in _set_dirty
    self.layer._dirty.add(self)
AttributeError: 'int' object has no attribute '_dirty'