1 decade ago by Gommeth
My idea is to use a piece of code like...
The desired effect would be that the draw order goes from top to bottom, so that the occlusion looks.. correct. Currently my problem is that when I use an alert, the zIndex appears for the first loop before map load as all 0's and the y's are undefined, and then after that both the zIndecies and the y's are both undefined.
Also, I've only used this engine and language for three days. Will this be too resource-heavy of an operation? Will it really decrease game performance if done maybe 4-5 times/sec?
Thanks in advance for all the help :D
var i = 0; var ents = ig.game.entities while (i < ents.length) { ig.game.entities[i].zIndex = ig.system.height - ig.game.entities[i].y; ++i; } ig.game.sortEntities();
The desired effect would be that the draw order goes from top to bottom, so that the occlusion looks.. correct. Currently my problem is that when I use an alert, the zIndex appears for the first loop before map load as all 0's and the y's are undefined, and then after that both the zIndecies and the y's are both undefined.
Also, I've only used this engine and language for three days. Will this be too resource-heavy of an operation? Will it really decrease game performance if done maybe 4-5 times/sec?
Thanks in advance for all the help :D