Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Array<Entity> renderThisFrame;
Array<Entity> actualRenderList;
function myRender (entity:Entity)
{
renderThisFrame.push(entity);
}
function justBeforeRender ()
{
for (entity in actualRenderList) {
if (! renderThisFrame.contains(entity)) {
actualRenderList.remove(entity);
scene.remove(entity);
}
}
for (entity in renderThisFrame) {
if (! actualRenderList.contains(entity)) {
actualRenderList.push(entity);
scene.add(enemy);
}
}
renderThisFrame.removeAll();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment