so debug tells me that hero.moveXY(maTarget.pos.x,maTarget.pos.y) uses null parameter instead of x=integer and y=integer. I thought that the elif would be false so that part of the code would not be executed.
As far as I understand coding : if maTarget.pos.x is null, it’s because maTarget is also null. So I do not get why anything after the elif would ever be executed. So I should be wrong somewhere and therefore ask if someone knows about it.
not especially. but could be used to optimze your movements on the map and avoid moving to dead enemies.
(only if the code was running as intended :’( )
Sometimes maTarget exists when you call GetCloser(maTarget) function, but dies or gets invisible on the 2d or 3d line of function, so hero stucks. Depends on loops and other code, of course. But it made me agrrhh! many times)
maTarget is any object with position so pos.x and pos.y. lets call it enemy
if the distance between hero and enemy is too much (10 here) and enemy still exist , I do half the travel. then call GetCloser() again
if the distance is ok (<10) and enemi still exist go to enemi.