Open TheJJ opened 4 years ago
It will be interesting if you can make some metaclass like (also this syntax is if function in nyan are the same declaration then python etc)
Health:
_hp = 0
_shield = 10 // the shield don't regen
function __get__():
return _hp
funciton __set__(value):
_hp = value
function __add__(value):
_hp += value
function __sub__(value):
if _shield < 0:
_hp -= value
else:
_shield -= value
Strider(Unit):
hp = Health
hp = 10
hp += 10 // so now hp == 20
hp -= 10 // hp still 20 because shield
hp -= 5 // hp == 15 because shield is below 0
animation = "./assets/strider.ani"
please open a separate issue for this feature request :) then we can discuss it independently of the python api.
nyan
needs a Python API in order to be used from Python code, like the openage-converter. Best to use Cython. It can be done with the traditional Cython approach by just wrapping the C++-code withpyx
andpxd
files.Using openage's Python interface is probably overkill (no need to call back and forth easily, translate exceptions from Py to C++, ...).