Posted September 02, 2017 by irskep
I went on a bug hunt and found a few solutions to my problems.
The memory leak was caused by some odd handling of the player object. I had been reusing the same entity across levels. Now I make a fresh copy for each level, which will let me make the transitions between levels more interesting. This solution also fixes the issue where the player sprite is in the wrong place at the start of the level.
Finally, I noticed that the enemies were all facing the wrong way. I flipped them around.