HTML5 – Pacman

I was talking to a colleague the other day about HTML5-Snake, and somehow the conversation drifted to Pacman…

After a weekend of investigating the Pacman (enemy) strategies, I took a break from doing EulerProject questions and began work on it.
It seemed simple enough: the background was pre-made, (sprites were handmade),  and it seemed very do-able.

It took me 2 days for the base code, +1 for memory/cpu profiling.
It is without sound, but I think it’s quite playable.

You can try it out here.

Some things I learned from this:

    The JS garbage collection can quickly degrade user experience, keep new objects to a minimum, reuse.
    For-loops can be optimized into do..while loops, as long as you have a negative counter and a check against zero.