Explosions now work. Had them working more or less OK much earlier, but more or less wasn’t quite good enough. Wrote a routine that calculated where each fragment of the sprite had to go and moved it to that location. Easy enough. Then realised that one row of fragments and one column of fragments weren’t moving - the explosion was off-centre.

Kept mucking around with the algorithm until I realised it made no sense (it made sense when I wrote it), so started again on paper. Such a simple routine yet got into all sorts of tangles trying to write it.

Anyway, it now works properly, in two directions - it functions as both an explosion (fragments radiate from a single point) and an implosion (fragments congregate to a single point). Means the same class doubles as the enemy explosion routine and the enemy warp-in routine.

Note to self (as I won’t remember this later) - when dealing with shapes that appear to have unusual explosion patterns, the missing fragments are just blank sprites. This is the standard situation (an “O” represents a fragment in the explosion):

OOOO
OOOO
OOOO
OOOO

This is the “unusual” situation:

__O__
_OOO_
OOOOO
_OOO_
__O__

It looks like it’s an exploding diamond shape, but the underscores are just blank sprites. (This is the way the pod explodes.)

Oh, and sprite palette changing still doesn’t work in anything but DeSmuME. I was looking at the wrong emulator ealier.