diff --git a/Throot.py b/Throot.py index 0878d8b..5e09ac4 100644 --- a/Throot.py +++ b/Throot.py @@ -64,17 +64,27 @@ class RoomTitle(Room): } # draw title sprite - title_text = 'press a to start' + #thumby.display.drawSprite(sprite_title.width, sprite_title.height, sprite_title.image) - chr_len = 5 - x = int(round(thumby.display.width / 2 - (chr_len * len(title_text)) / 2)) - y = int(round(thumby.display.height / 2 - chr_len / 2)) + thumby.display.blit(sprite_title.image, 0, 0, sprite_title.width, sprite_title.height, + -1, 0, 0) + # title text + chrx = 5 + chry = 7 buff = 2 - w = chr_len * len(title_text) + buff - h = chr_len + buff - thumby.display.drawFilledRectangle(x - buff, y - buff, w, h, 1) - thumby.display.drawText(title_text, x, y, 0) + + x = 14#int(round(thumby.display.width / 2 - (chr_len * len(title_text)) / 2)) + y = 40 - chry - buff#int(round(thumby.display.height / 2 - chr_len / 2)) + + w = chrx * 6 + buff + h = chry + buff + thumby.display.drawFilledRectangle(x - buff, y - buff, w, h * 2 + buff, 0) + #thumby.display.drawText('press a', x, y, 0) + thumby.display.drawText('start', x, y, 1) + + thumby.display.blit(sprite_buttona.image, 2, 40 - 8, sprite_buttona.width, sprite_buttona.height, + -1, 0, 0) class GameLoop(Room): def __init__(self): diff --git a/ThrootTitle.bmp b/ThrootTitle.bmp new file mode 100644 index 0000000..0524c47 Binary files /dev/null and b/ThrootTitle.bmp differ diff --git a/ThrootTitleSingleFrame.bmp b/ThrootTitleSingleFrame.bmp new file mode 100644 index 0000000..61726f3 Binary files /dev/null and b/ThrootTitleSingleFrame.bmp differ diff --git a/artrepository.py b/artrepository.py index 09464ed..015d3ef 100644 --- a/artrepository.py +++ b/artrepository.py @@ -182,4 +182,19 @@ sprite_water = SpriteImage( 8 ) +sprite_title = SpriteImage( + bytearray([32,128,40,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,0,0,0,0,0,0,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,160,128,32,0,72,0,192,96,24,8,4,6,2,2,2,2,2,4,12,24,112,192,0,0,0,3,3,3,3,3,255,255,255,3,251,251,251,3,3,251,251,251,3,251,251,155,155,155,155,99,99,0,248,248,24,24,24,251,251,3,251,251,27,27,27,251,251,3,255,255,255,3,3,3,0,1,0,31,48,96,64,64,64,98,50,30,0,0,192,96,48,16,24,15,12,24,48,96,192,0,0,0,255,255,255,0,255,255,255,7,7,255,255,255,0,255,255,1,1,1,3,255,255,0,255,255,128,128,128,255,255,0,255,255,128,128,128,255,255,0,255,255,255,0,0,0,0,192,64,96,32,32,69,192,10,0,4,0,0,127,129,0,0,0,0,0,0,0,96,48,29,7,0,0,63,255,255,192,149,85,85,84,84,85,85,85,84,85,85,84,84,84,84,85,85,84,85,85,85,85,85,85,85,84,85,85,85,85,85,85,21,192,255,255,127,0,0,0,3,7,4,132,128,192,96,29,70,0,0,0,0,0,1,6,12,8,24,16,248,140,4,4,108,72,120,48,0,128,193,255,255,127,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,252,254,255,183,99,65,64,64,96,48,24,30,99,65,64,194,128,133,0,2,0,128,96,24,12,4,2,2,1,1]), + None, + 72, + 40 +) + +sprite_water = SpriteImage( + bytearray([60,98,221,203,203,221,98,60]) + bytearray([56,68,186,150,150,186,68,56]), + None, + 8, + 8 +) + + OBSTACLES = [skull, pizza, boulder, ball, steve, mathroot, leaf, robot, dinoskull, dinojaw, dinospine, bone, bigdinohead, bigboneddiag, bigdoritoobstacle, spaceinv,annoydead,lvl4wall,ballobstaclelvl3,Doritoobstaclelvl5] \ No newline at end of file diff --git a/player.py b/player.py index 8e87f4c..78ef1dc 100644 --- a/player.py +++ b/player.py @@ -103,8 +103,8 @@ class Camera: class PlayerAnimation: - # width and height of range bounding box - RANDOM_RANGE = int(7) + # width and height of range bounding box must be odd + RANDOM_RANGE = int(5) POS_RANGE = int(3) POS_X = int(0) POS_Y = int(1) @@ -115,26 +115,6 @@ class PlayerAnimation: self.debugposrange = self.POS_RANGE def update_phys(self, plworldx, plworldy, camera): - - #print(plworldx, plworldy, plscreeny, current_depth) - - ### exit if player y pos less than random range - # # debug change random range - # inp = int(0) - # if thumby.buttonD.justPressed(): - # inp -= 1 - # if thumby.buttonU.justPressed(): - # inp += 1 - - # if inp != 0: - # self.debugposrange = max(self.debugposrange + inp * 2, 1) - # print('debugposrange: ', self.debugposrange) - - # # if plworldy < self.poslist[-1][self.POS_Y] + random.randint(1, self.debugposrange): - # # return - - # if plworldy < self.poslist[-1][self.POS_Y] + self.debugposrange: - # return if plworldy < self.poslist[-1][self.POS_Y] + self.POS_RANGE: return @@ -142,23 +122,6 @@ class PlayerAnimation: ### get new position rad = self.RANDOM_RANGE // 2 - # # debug change random range - # inp = int(0) - # if thumby.buttonB.justPressed(): - # inp -= 1 - # if thumby.buttonA.justPressed(): - # inp += 1 - - # if inp != 0: - # self.debugrandomrange = max(self.debugrandomrange + inp * 2, 1) - # print('debugrandomrange:', self.debugrandomrange) - - # rad = max(self.debugrandomrange // 2, 1) - - # vector int - # self.poslist.append((plworldx + random.randrange(-rad, rad), - # plworldy + random.randrange(-rad, rad))) - # move last pos self.poslist[-1] = ( plworldx + random.randrange(-rad, rad), @@ -168,20 +131,13 @@ class PlayerAnimation: # new pos is perfectly on player self.poslist.append((plworldx, plworldy)) - # # debug - # self.poslist.append((plworldx, plworldy)) - ### remove the fist item in the list if its full line is off screen if not camera.entity_in_camera(self.poslist[1][self.POS_X], self.poslist[1][self.POS_Y]): self.poslist.pop(0) - #print(len(self.poslist)) - def update_draw(self, camera, isdecend=1): ### draw line from first position to next - #print(topleft) - for i in range(len(self.poslist) - 1): x1, y1 = camera.relative_to_camera(self.poslist[i][self.POS_X], self.poslist[i][self.POS_Y]) x2, y2 = camera.relative_to_camera(self.poslist[i + 1][self.POS_X], self.poslist[i + 1][self.POS_Y])