Python script to extract tile data and sprites from Commander Keen 1-3 levels, using information from here and here.
The script can be used standalone like this:
python keen.py file
This returns two files, one named data
and one named sprites
containg the tile IDs and sprite IDs as python list structures.
The script can also be used as a module, like so:
import keen
The module has two methods.
decompress(file)
Expects a filename as a string. Returns a string representing the entire decompressed file.
convert(data)
Excepts data to be a string. Returns a tuple containg the lists of tiles a sprites.
To retrieve all the data from the file "LEVEL1".
tiles, sprites = convert(decompress("LEVEL1"))