1 decade ago by igr
Hi all,
I was replacing getEntitiesByType() with getEntityByName(). It seems to work until my main Hero dies and should be respawned. Then I get an error that the variabel player (var player = ig.game.getEntityByName('hero') is undefined. I understand the logic of the error: the hero is killed but some entities are trying to get hold of it. What I do not understand is why getEntitiesByType() works perfectly here, but getEntityByName() fails?
Another thing is: how to restart the whole level when the main Hero is killed?
Thank you!
I was replacing getEntitiesByType() with getEntityByName(). It seems to work until my main Hero dies and should be respawned. Then I get an error that the variabel player (var player = ig.game.getEntityByName('hero') is undefined. I understand the logic of the error: the hero is killed but some entities are trying to get hold of it. What I do not understand is why getEntitiesByType() works perfectly here, but getEntityByName() fails?
Another thing is: how to restart the whole level when the main Hero is killed?
Thank you!