Sprite animations: use safer data structures and add assertions (#26).

Issue #26 is no longer a segfault but an explicit assertion error.