diff --git a/artrepository.py b/artrepository.py index 39a36cd..127633d 100644 --- a/artrepository.py +++ b/artrepository.py @@ -1,51 +1,136 @@ +from collections import namedtuple + +SpriteImage = namedtuple("SpriteImage", ["image", "collision", "width", "height"]) + # BITMAP: width: 8, height: 8 -skull = bytearray([227,29,102,126,38,222,221,227])# BITMAP: width: 8, height: 8 -pizza = bytearray([127,63,95,111,87,107,125,0]) +skull = SpriteImage( + bytearray([227,29,102,126,38,222,221,227]), + None, + 8, + 8 +) +# BITMAP: width: 8, height: 8 +pizza = SpriteImage( + bytearray([127,63,95,111,87,107,125,0]), + None, + 8, + 8 +) # BITMAP: width: 10, height: 10 -boulder = bytearray([31,175,119,183,107,251,115,7,15,31, - 3,2,1,0,1,0,0,0,0,2]) +boulder = SpriteImage( + bytearray([31,175,119,183,107,251,115,7,15,31,3,2,1,0,1,0,0,0,0,2]), + None, + 10, + 10 +) # BITMAP: width: 10, height: 10 -ball = bytearray([135,43,85,170,124,254,122,229,123,135, - 3,3,2,0,1,0,1,2,3,3])# BITMAP: width: 10, height: 10 -ball = bytearray([120,212,170,85,131,1,133,26,132,120, - 0,0,1,3,2,3,2,1,0,0])# BITMAP: width: 10, height: 10 -steve = bytearray([0,240,252,92,188,188,92,252,240,0, - 0,1,1,0,0,0,0,1,1,0]) +ball = SpriteImage( + bytearray([135,43,85,170,124,254,122,229,123,135,3,3,2,0,1,0,1,2,3,3]), + None, + 10, + 10 +) +# BITMAP: width: 10, height: 10 +ball = SpriteImage( + bytearray([120,212,170,85,131,1,133,26,132,120,0,0,1,3,2,3,2,1,0,0]), + None, + 10, + 10 +) +# BITMAP: width: 10, height: 10 +steve = SpriteImage( + bytearray([0,240,252,92,188,188,92,252,240,0,0,1,1,0,0,0,0,1,1,0]), + None, + 10, + 10 +) # BITMAP: width: 11, height: 8 -spaceinv = bytearray([143,231,130,73,67,195,67,73,130,231,143]) +spaceinv = SpriteImage( + bytearray([143,231,130,73,67,195,67,73,130,231,143]), + None, + 11, + 8 +) # BITMAP: width: 11, height: 8 -spaceinv2 = bytearray([248,103,130,201,195,195,195,201,130,103,248]) +spaceinv2 = SpriteImage( + bytearray([248,103,130,201,195,195,195,201,130,103,248]), + None, + 11, + 8 +) # BITMAP: width: 11, height: 8 -mathroot = bytearray([255,255,239,207,159,63,1,193,249,249,255]) +mathroot = SpriteImage( + bytearray([255,255,239,207,159,63,1,193,249,249,255]), + None, + 11, + 8 +) #/ = bytearray([255,255,239,239,72,10,192,10,72,239,239]) # BITMAP: width: 11, height: 8 -robot = bytearray([255,255,239,239,72,10,192,10,72,239,239]) +robot = SpriteImage( + bytearray([255,255,239,239,72,10,192,10,72,239,239]), + None, + 11, + 8 +) # BITMAP: width: 11, height: 8 -dinoskull# BITMAP: width: 11, height: 8 -dinojaw = bytearray([240,246,246,245,238,237,219,221,235,247,255]) = bytearray([193,190,190,62,118,242,126,249,87,239,31]) +dinoskull = SpriteImage( + bytearray([240,246,246,245,238,237,219,221,235,247,255]), + None, + 11, + 8 +) # BITMAP: width: 11, height: 8 -dinospine= bytearray([199,187,215,187,199,199,187,215,187,199,255]) +dinojaw = SpriteImage( + bytearray([193,190,190,62,118,242,126,249,87,239,31]), + None, + 11, + 8 +) # BITMAP: width: 11, height: 8 -bone = bytearray([215,171,187,215,215,215,215,215,187,171,215]) +dinospine = SpriteImage( + bytearray([199,187,215,187,199,199,187,215,187,199,255]), + None, + 11, + 8 +) +# BITMAP: width: 11, height: 8 +bone = SpriteImage( + bytearray([215,171,187,215,215,215,215,215,187,171,215]), + None, + 11, + 8 +) # BITMAP: width: 70, height: 40 -bigdinohead = bytearray([255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, - 255,255,255,255,255,255,127,127,127,127,127,127,127,127,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, - 255,231,193,157,124,254,118,243,243,225,225,243,159,158,140,253,153,243,247,207,159,63,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, - 255,255,255,255,249,250,247,246,244,245,243,245,243,245,243,245,243,245,251,253,254,254,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, - 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255]) +bigdinohead = SpriteImage( + bytearray([255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,127,127,127,127,127,127,127,127,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,231,193,157,124,254,118,243,243,225,225,243,159,158,140,253,153,243,247,207,159,63,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,249,250,247,246,244,245,243,245,243,245,243,245,243,245,251,253,254,254,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255]), + None, + 70, + 40 +) # BITMAP: width: 70, height: 40 -bigboneddiag = bytearray([255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, - 255,127,127,63,223,223,63,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, - 252,251,251,251,247,239,222,189,123,247,239,223,191,127,127,127,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, - 255,255,255,255,255,255,255,255,255,254,241,239,239,243,251,251,252,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, - 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255]) +bigboneddiag = SpriteImage( + bytearray([255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,127,127,63,223,223,63,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,252,251,251,251,247,239,222,189,123,247,239,223,191,127,127,127,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,254,241,239,239,243,251,251,252,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255]), + None, + 70, + 40 +) # BITMAP: width: 70, height: 40 - # BITMAP: width: 70, height: 40 -bigdoritoobstacle = bytearray([254,244,253,219,251,247,175,207,223,223,223,191,63,127,127,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, - 255,255,255,255,223,255,247,255,255,255,249,255,239,254,254,252,252,249,219,243,183,167,239,207,223,191,63,127,127,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, - 255,127,255,127,191,95,191,95,191,87,47,87,47,151,175,155,151,203,215,235,231,235,231,235,231,235,231,235,231,234,246,245,241,243,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,127,127,127,127,127,127,127,127,127,63,191,191,191, - 250,249,248,253,252,254,254,254,254,255,255,255,255,255,255,255,255,255,255,255,255,127,127,127,127,127,127,127,127,127,127,127,127,191,191,159,223,223,223,223,223,239,239,239,239,239,239,231,231,243,123,251,253,254,254,254,254,255,239,251,255,255,255,255,251,255,253,251,254,255, - 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,254,253,253,253,253,253,249,251,251,251,245,243,237,235,229,235,215,203,223,215,203,215,222,219,203,213,203,215,207,215,207,215,223,207,215,207,215,159,151,175,183,171,183,175,183,191,159,55,127]) +bigdoritoobstacle = SpriteImage( + bytearray([254,244,253,219,251,247,175,207,223,223,223,191,63,127,127,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,223,255,247,255,255,255,249,255,239,254,254,252,252,249,219,243,183,167,239,207,223,191,63,127,127,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,127,255,127,191,95,191,95,191,87,47,87,47,151,175,155,151,203,215,235,231,235,231,235,231,235,231,235,231,234,246,245,241,243,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,127,127,127,127,127,127,127,127,127,63,191,191,191,250,249,248,253,252,254,254,254,254,255,255,255,255,255,255,255,255,255,255,255,255,127,127,127,127,127,127,127,127,127,127,127,127,191,191,159,223,223,223,223,223,239,239,239,239,239,239,231,231,243,123,251,253,254,254,254,254,255,239,251,255,255,255,255,251,255,253,251,254,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,254,253,253,253,253,253,249,251,251,251,245,243,237,235,229,235,215,203,223,215,203,215,222,219,203,213,203,215,207,215,207,215,223,207,215,207,215,159,151,175,183,171,183,175,183,191,159,55,127]), + None, + 70, + 40 +) # BITMAP: width: 16, height: 16 -leaf = bytearray([128,1,1,1,3,3,3,71,135,15,15,31,63,255,255,255, - 255,254,252,248,240,240,224,224,192,193,194,196,200,144,1,63]) \ No newline at end of file +leaf = SpriteImage( + bytearray([128,1,1,1,3,3,3,71,135,15,15,31,63,255,255,255,255,254,252,248,240,240,224,224,192,193,194,196,200,144,1,63]), + None, + 16, + 16 +) + +UNDERGROUND_OBSTACLES = [skull, pizza, boulder, ball, steve, mathroot, robot, dinoskull, dinojaw, dinospine, bone, bigdinohead, bigboneddiag, bigdoritoobstacle] +OVERGROUND_OBSTACLES = [spaceinv, spaceinv2, leaf] + +OBSTACLES = UNDERGROUND_OBSTACLES + OVERGROUND_OBSTACLES