diff --git a/BatteryPet/BatteryPet.py b/BatteryPet/BatteryPet.py new file mode 100644 index 0000000..9e92ee3 --- /dev/null +++ b/BatteryPet/BatteryPet.py @@ -0,0 +1,669 @@ +#Thanks to @AyreGuitar +# +#Based on code posted by: +#@JasonTC from Discord channel https://discord.com/channels/898292107289190461/898292174410612787/972253183814541342 +#@TPReal from Discord channel https://discord.com/channels/898292107289190461/898292174410612787/975659380232060978 +# +#Disclaimer: +#Use at your own risk, no warranties or guarantees + +import thumby +from machine import ADC +import time + +thumby.saveData.setName("BatteryPet") + +adc = ADC(26) + +charging = 38000 +#level_0 = 32000 #~70min shuts off +level_1 = 33700 #~45min +level_2 = 34300 #~30min +level_3 = 35400 #~15min + +if (thumby.saveData.hasItem("hearts")): + hearts = int(thumby.saveData.getItem("hearts")) +else: + hearts = -1 + +if (thumby.saveData.hasItem("score")): + score = int(thumby.saveData.getItem("score")) +else: + score = 0 + +if (thumby.saveData.hasItem("stage")): + stage = int(thumby.saveData.getItem("stage")) +else: + stage = 0 + +if (thumby.saveData.hasItem("charges")): + charges = int(thumby.saveData.getItem("charges")) +else: + charges = 0 + +if (thumby.saveData.hasItem("pets")): + pets = int(thumby.saveData.getItem("pets")) +else: + pets = 0 + +# BITMAP: width: 32, height: 38 +egg1 = bytearray([255,255,255,255,255,255,63,63,207,207,207,207,243,243,243,243,243,243,243,243,207,207,207,207,63,63,255,255,255,255,255,255, + 255,255,15,15,240,240,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,252,252,204,204,0,0,15,15,255,255, + 0,0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,12,12,243,243,0,0,0,0, + 252,252,3,3,63,63,207,207,63,63,207,207,63,63,207,207,63,63,207,207,51,51,12,12,51,51,12,12,0,0,252,252, + 48,48,48,48,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,48,48,48,48]) +egg2 = bytearray([255,255,255,255,255,255,63,63,207,207,243,243,252,252,252,252,252,252,240,240,51,51,15,15,63,63,255,255,255,255,255,255, + 255,255,63,63,195,195,252,252,255,255,255,255,255,255,255,255,255,255,255,255,255,255,51,51,192,192,3,3,63,63,255,255, + 255,255,0,0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,51,51,204,204,0,0,0,0,255,255, + 255,255,252,252,3,3,63,63,207,207,63,63,207,207,63,63,207,207,51,51,12,12,51,51,12,12,0,0,252,252,255,255, + 63,63,48,48,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,48,48,63,63]) +eggcrack1 = bytearray([255,255,255,255,255,255,63,63,207,207,243,243,252,252,252,252,252,252,240,240,51,51,15,15,63,63,255,255,255,255,255,255, + 255,255,63,63,195,195,252,252,255,255,255,255,255,255,255,255,255,255,255,255,255,255,51,51,192,192,3,3,63,63,255,255, + 255,255,0,0,243,243,207,207,63,63,207,207,243,243,207,207,63,63,207,207,243,243,3,3,204,204,0,0,0,0,255,255, + 255,255,252,252,3,3,63,63,207,207,63,63,207,207,63,63,207,207,51,51,12,12,51,51,12,12,0,0,252,252,255,255, + 63,63,48,48,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,48,48,63,63]) +eggcrack2 = bytearray([255,255,255,255,255,255,63,63,207,207,207,207,243,243,243,243,243,243,243,243,207,207,207,207,63,63,255,255,255,255,255,255, + 255,255,15,15,240,240,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,252,252,204,204,0,0,15,15,255,255, + 0,0,243,243,207,207,63,63,207,207,243,243,207,207,63,63,207,207,243,243,207,207,63,63,12,12,243,243,0,0,0,0, + 252,252,3,3,63,63,207,207,63,63,207,207,63,63,207,207,63,63,207,207,51,51,12,12,51,51,12,12,0,0,252,252, + 48,48,48,48,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,48,48,48,48]) + +# BITMAP: width: 60, height: 40 +eggopen1 = bytearray([255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,7,7,153,153,225,225,255,255,255,255,255,255,255,255,255,255,255,255,255,243,243,255,255,255,255,255,255,255,255,255,31,31,159,159,127,127,255,255,255,255,255,255,255, + 255,255,255,7,7,249,249,25,25,225,225,255,255,255,255,255,255,254,254,255,255,255,63,63,207,207,51,51,243,243,243,243,243,243,243,243,51,51,207,207,63,63,255,255,255,255,255,254,254,249,249,224,224,255,255,255,255,255,255,255, + 255,255,255,254,254,249,249,254,126,127,255,255,255,252,252,255,255,255,255,255,255,255,0,0,255,255,255,255,0,0,0,0,0,0,0,0,255,255,255,255,0,0,255,255,63,63,255,255,249,249,255,255,127,127,135,135,249,249,7,7, + 255,255,255,255,255,255,255,255,254,254,255,255,255,255,255,255,240,240,12,12,243,243,243,243,204,204,195,195,243,243,243,243,243,243,243,243,51,51,192,192,51,51,204,204,3,3,240,240,255,255,255,255,126,126,249,249,249,249,254,254, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,195,195,195,195,0,0,0,0,0,0,3,3,3,3,3,3,3,3,3,3,0,0,3,3,0,0,3,3,192,192,195,195,255,255,255,255,255,255,254,254,255,255,255,255,255,255]) +eggopen2 = bytearray([255,255,255,255,255,255,255,255,255,255,255,243,243,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,243,243,255,255,255,255,255,255,255,255,255,243,243,255,255,255,255,255,255,255,255,255,255,255,63,63,255,255,255,255,255,255, + 255,255,255,255,255,207,207,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,63,63,207,207,51,51,243,243,243,243,243,243,243,243,51,51,207,207,63,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,127,127,255,255,255,255,255,255,255,255,255,255,255,255,0,0,255,255,255,255,0,0,0,0,0,0,0,0,255,255,255,255,0,0,255,255,63,63,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,254,254,255,255,255,255,255,255,240,240,12,12,243,243,243,243,204,204,195,195,243,243,243,243,243,243,243,243,51,51,192,192,51,51,204,204,3,3,240,240,255,255,255,255,255,255,243,243,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,195,195,195,195,0,0,0,0,0,0,3,3,3,3,3,3,3,3,3,3,0,0,3,3,0,0,3,3,192,192,195,195,255,255,255,255,255,255,255,255,255,255,255,255,255,255]) +eggopen3 = 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,255,255,255,255,255,255,255,255,63,63,207,207,207,207,195,195,195,195,207,207,207,207,63,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,0,0,255,255,252,252,3,3,3,3,3,3,3,3,252,252,255,255,0,0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,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,252,243,243,207,207,204,204,204,204,204,204,204,204,207,207,243,243,252,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]) +eggopen4 = 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,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,63,63,207,207,243,243,51,51,252,252,252,252,252,252,51,51,243,243,207,207,63,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,0,0,255,255,255,255,252,252,255,207,207,207,207,255,252,252,255,255,255,255,0,0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,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,252,252,252,252,252,252,252,252,252,252,252,252,252,252,252,252,252,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255]) + +# BITMAP: width: 30, height: 30 +babymedium1 = bytearray([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,192,192,240,240,240,240,252,252,252,252,252,252,240,240,240,240,192,192,0,0,0,0,0,0, + 0,0,0,0,255,255,255,255,255,255,255,255,240,240,255,255,63,63,63,63,255,255,240,240,255,255,0,0,0,0, + 0,0,0,0,0,0,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,0,0,0,0,0,0]) +babymedium2 = bytearray([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,192,192,240,240,252,252,252,252,63,63,255,255,255,255,252,252,252,252,48,48,192,192,0,0, + 0,0,0,0,0,0,63,63,255,255,255,255,255,255,252,252,255,255,255,255,207,207,207,207,252,252,63,63,0,0, + 0,0,0,0,0,0,0,0,0,0,3,3,3,3,0,0,3,3,3,3,0,0,3,3,0,0,0,0,0,0]) +babymedium3 = bytearray([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,192,192,240,240,240,240,252,252,252,252,252,252,240,240,240,240,192,192,0,0, + 0,0,0,0,0,0,0,0,255,255,255,255,255,255,255,255,240,240,255,255,255,255,63,63,63,63,240,240,255,255, + 0,0,0,0,0,0,0,0,0,0,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,0,0]) +babymedium4 = bytearray([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,192,192,48,48,252,252,252,252,255,255,255,255,63,63,252,252,252,252,240,240,192,192,0,0, + 0,0,0,0,0,0,63,63,252,252,255,255,207,207,207,207,255,255,252,252,255,255,255,255,255,255,63,63,0,0, + 0,0,0,0,0,0,0,0,0,0,3,3,0,0,3,3,3,3,0,0,3,3,3,3,0,0,0,0,0,0]) +babymedium5 = bytearray([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,192,192,240,240,240,240,252,252,252,252,252,252,240,240,240,240,192,192,0,0,0,0,0,0, + 0,0,0,0,255,255,240,240,255,255,63,63,63,63,255,255,240,240,255,255,255,255,255,255,255,255,0,0,0,0, + 0,0,0,0,0,0,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,0,0,0,0,0,0]) +babymedium6 = bytearray([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,192,192,48,48,252,252,252,252,255,255,255,255,63,63,252,252,252,252,240,240,192,192,0,0,0,0,0,0, + 0,0,63,63,252,252,255,255,207,207,207,207,255,255,252,252,255,255,255,255,255,255,63,63,0,0,0,0,0,0, + 0,0,0,0,0,0,3,3,0,0,3,3,3,3,0,0,3,3,3,3,0,0,0,0,0,0,0,0,0,0]) +babymedium7 = bytearray([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,192,192,240,240,240,240,252,252,252,252,252,252,240,240,240,240,192,192,0,0,0,0,0,0,0,0,0,0, + 255,255,240,240,255,255,63,63,63,63,255,255,240,240,255,255,255,255,255,255,255,255,0,0,0,0,0,0,0,0, + 0,0,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,0,0,0,0,0,0,0,0,0,0]) +babymedium8 = bytearray([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 192,192,240,240,252,252,252,252,63,63,255,255,255,255,252,252,252,252,48,48,192,192,0,0,0,0,0,0,0,0, + 63,63,255,255,255,255,255,255,252,252,255,255,207,207,207,207,255,255,252,252,63,63,0,0,0,0,0,0,0,0, + 0,0,0,0,3,3,3,3,0,0,3,3,3,3,0,0,3,3,0,0,0,0,0,0,0,0,0,0,0,0]) +babymedium9 = bytearray([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,192,192,240,240,240,240,252,252,252,252,252,252,240,240,240,240,192,192,0,0,0,0,0,0,0,0, + 0,0,255,255,255,255,255,255,255,255,240,240,255,255,63,63,63,63,255,255,240,240,255,255,0,0,0,0,0,0, + 0,0,0,0,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,0,0,0,0,0,0,0,0]) +babymedium10 = bytearray([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,192,192,240,240,252,252,252,252,63,63,255,255,255,255,252,252,252,252,48,48,192,192,0,0,0,0, + 0,0,0,0,63,63,255,255,255,255,255,255,252,252,255,255,207,207,207,207,255,255,252,252,63,63,0,0,0,0, + 0,0,0,0,0,0,0,0,3,3,3,3,0,0,3,3,3,3,0,0,3,3,0,0,0,0,0,0,0,0]) + +babysad1 = bytearray([0,0,0,0,0,0,0,0,0,0,0,0,192,192,192,192,192,192,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,192,192,252,252,204,207,207,207,243,243,255,255,243,243,207,207,207,207,252,252,192,192,0,0,0,0, + 0,0,0,0,15,15,63,63,255,255,255,255,192,192,192,192,192,192,255,255,255,255,63,63,15,15,0,0,0,0, + 0,0,0,0,0,0,3,3,3,3,0,0,3,3,3,3,3,3,0,0,3,3,3,3,0,0,0,0,0,0]) +babysad2 = bytearray([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,192,192,240,240,240,240,252,252,252,252,252,252,240,240,240,240,192,192,0,0,0,0,0,0, + 0,0,0,0,63,63,243,243,243,243,252,252,63,63,63,63,63,63,252,252,243,243,243,243,63,63,0,0,0,0, + 0,0,0,0,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,0,0,0,0]) + +babyenergie1 = bytearray([192,192,12,12,0,0,192,192,240,240,240,240,252,252,252,252,252,252,240,240,240,240,192,192,3,3,0,48,48,0, + 0,0,0,0,255,255,252,252,252,252,51,51,63,63,63,63,63,63,51,51,252,252,252,252,255,255,0,0,0,0, + 0,0,0,0,0,0,15,15,255,255,60,60,240,240,240,240,240,240,60,60,255,255,15,15,0,0,0,0,0,0, + 0,0,0,0,0,0,3,3,3,3,0,0,0,0,3,3,0,0,0,0,3,3,3,3,0,0,0,0,0,0]) +babyenergie2 = bytearray([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,192,192,240,240,60,60,60,60,255,255,255,255,255,255,252,252,60,60,48,48,192,192,0,0,0,0, + 0,0,0,0,15,15,60,60,255,255,255,255,252,252,207,207,207,207,204,204,255,255,63,63,15,15,0,0,0,0, + 0,0,0,0,0,0,3,3,3,3,3,3,0,0,3,3,3,3,0,0,3,3,3,3,0,0,0,0,0,0]) + +babylow1 = bytearray([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,192,192,240,240,240,240,252,252,252,252,252,252,240,240,240,240,192,192,0,0,0,0,0,0, + 0,0,0,0,255,255,255,255,255,255,255,255,240,240,255,255,63,63,63,63,255,255,240,240,255,255,0,0,0,0, + 0,0,0,0,0,0,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,0,0,0,0,0,0]) +babylow2 = bytearray([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,192,192,240,240,252,252,252,252,63,63,255,255,255,255,252,252,252,252,48,48,192,192,0,0,0,0, + 0,0,0,0,63,63,255,255,255,255,255,255,252,252,255,255,207,207,207,207,255,255,252,252,63,63,0,0,0,0, + 0,0,0,0,0,0,0,0,3,3,3,3,0,0,3,3,3,3,0,0,3,3,0,0,0,0,0,0,0,0]) + +babyfull1 = bytearray([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,192,192,240,240,240,240,252,252,252,252,252,252,240,240,240,240,192,192,0,0,0,0,0,0, + 0,0,0,0,255,255,255,255,255,255,240,240,255,159,63,63,159,255,240,240,255,255,255,255,255,255,0,0,0,0, + 0,0,0,0,0,0,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,3,0,0,0,0,0,0]) +babyfull2 = bytearray([0,0,0,0,0,0,0,0,0,0,0,0,192,192,192,192,192,192,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,240,240,252,252,255,255,15,15,255,255,255,255,255,255,15,15,255,255,252,252,240,240,0,0,0,0, + 0,0,0,0,15,15,63,63,127,127,63,63,63,57,51,51,57,63,63,63,63,127,127,63,15,15,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]) +babyfull3 = bytearray([0,0,0,0,0,0,192,192,240,240,240,240,252,252,252,252,252,252,240,240,240,240,192,192,0,0,0,0,0,0, + 0,0,0,0,255,255,255,255,255,255,240,240,255,159,63,63,159,255,240,240,255,255,255,255,255,255,0,0,0,0, + 0,0,0,0,0,0,3,3,7,7,3,3,3,3,3,3,3,3,3,3,7,7,3,3,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]) + +# BITMAP: width: 40, height: 30 +poopenergie1 = bytearray([0,0,0,0,0,0,0,0,0,0,96,96,0,0,0,0,0,0,0,0,240,240,192,192,0,0,0,48,48,0,0,0,0,0,0,0,0,0,0,0, + 0,0,128,128,0,0,0,0,0,0,0,0,192,192,252,252,255,255,255,255,255,255,255,255,252,252,240,240,0,0,0,0,0,0,192,192,0,0,0,0, + 0,0,1,1,0,0,192,192,48,48,207,207,255,255,255,255,156,156,63,63,63,63,156,156,255,255,255,255,255,255,240,240,192,192,0,0,0,0,0,0, + 0,0,0,0,0,0,15,15,60,60,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,15,15,0,0,0,0,0,0]) +poopenergie2 = bytearray([0,0,0,0,0,0,0,0,0,6,6,0,0,0,240,240,252,252,255,255,252,252,252,252,240,240,192,192,0,0,0,12,12,0,0,0,0,0,0,0, + 0,0,0,0,0,0,3,3,192,192,240,240,255,255,255,255,63,63,255,255,255,255,63,63,255,255,255,255,255,255,240,240,0,0,3,3,0,0,0,0, + 6,6,0,0,240,240,12,12,243,243,255,255,255,255,255,255,231,231,207,207,207,207,231,231,255,255,255,255,255,255,255,255,255,255,252,252,0,0,12,12, + 0,0,0,0,15,15,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,15,15,0,0,0,0]) +poopfull1 = bytearray([0,0,0,0,0,0,0,0,192,192,0,0,0,0,0,0,0,0,0,0,240,240,192,192,0,0,48,48,48,48,207,207,48,48,48,48,0,0,0,0, + 0,0,0,0,0,0,3,3,12,12,3,3,192,192,252,252,255,255,255,255,255,255,255,255,252,252,240,240,0,0,3,3,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,192,192,48,48,207,207,255,255,255,255,156,156,63,63,63,63,156,156,255,255,255,255,255,255,240,240,192,192,0,0,0,0,0,0, + 0,0,0,0,0,0,15,15,60,60,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,15,15,0,0,0,0,0,0]) +poopfull2 = bytearray([0,48,48,48,48,207,207,48,48,48,48,0,0,0,240,240,252,252,255,255,240,240,240,240,192,192,0,0,0,0,0,0,96,96,152,152,96,96,0,0, + 0,0,0,0,0,3,3,0,192,192,240,240,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,240,240,192,192,0,0,1,1,0,0,0,0, + 0,0,0,0,240,240,12,12,243,243,255,255,255,255,255,255,156,156,63,63,63,63,156,156,255,255,255,255,255,255,255,255,252,252,240,240,0,0,0,0, + 0,0,0,0,15,15,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,15,15,0,0,0,0]) +poopmedium1 = bytearray([0,0,0,0,0,0,0,0,192,192,0,0,0,0,0,0,0,0,0,0,240,240,192,192,0,0,48,48,48,48,207,207,48,48,48,48,0,0,0,0, + 0,0,0,0,0,0,3,3,12,12,3,3,192,192,252,252,255,255,255,255,255,255,255,255,252,252,240,240,0,0,3,3,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,192,192,48,48,207,207,255,255,255,255,252,188,63,63,63,63,188,252,255,255,255,255,255,255,240,240,192,192,0,0,0,0,0,0, + 0,0,0,0,0,0,15,15,60,60,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,15,15,0,0,0,0,0,0]) +poopmedium2 = bytearray([192,192,192,192,60,60,192,192,192,192,0,0,0,0,0,0,0,0,0,0,240,240,192,192,0,0,0,0,0,192,192,48,48,192,192,0,0,0,0,0, + 0,0,0,0,15,15,0,0,0,0,0,0,192,192,252,252,255,255,255,255,255,255,255,255,252,252,240,240,0,0,0,3,3,0,0,0,0,0,0,0, + 0,0,0,0,0,0,192,192,48,48,207,207,255,255,255,255,252,188,63,63,63,63,188,252,255,255,255,255,255,255,240,240,192,192,0,0,0,0,0,0, + 0,0,0,0,0,0,15,15,60,60,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,63,15,15,0,0,0,0,0,0]) +pooplow1 = bytearray([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,192,192,192,192,240,240,192,192,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,192,192,240,240,252,252,255,255,159,159,255,255,255,255,159,159,255,255,252,252,240,240,192,192,0,0,0,0,0,0,0,0, + 0,0,0,0,48,48,63,63,48,48,63,63,63,63,63,63,63,63,51,51,51,51,63,63,63,63,63,63,63,63,63,63,63,63,48,48,0,0,0,0]) +pooplow2 = bytearray([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,192,192,192,192,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,192,192,240,240,240,240,252,252,252,252,159,159,255,255,255,255,159,159,255,255,252,252,240,240,192,192,192,192,0,0,0,0,0,0, + 48,48,60,60,51,51,60,60,63,63,63,63,63,63,63,63,63,55,51,51,51,51,55,63,63,63,63,63,63,63,63,63,63,63,63,63,60,60,48,48]) +poopsad1 = bytearray([0,0,0,0,128,128,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,6,7,15,15,3,0,0,96,96,0,0,0,0,0,0,192,192,192,192,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,192,192,240,240,240,240,252,252,252,252,159,159,255,255,255,255,159,159,255,255,252,252,240,240,192,192,192,192,0,0,0,0,0,0, + 48,48,60,60,51,51,60,60,63,63,63,63,63,63,63,63,63,55,51,59,59,51,55,63,63,63,63,63,63,63,63,63,63,63,63,63,60,60,48,48]) +poopsad2 = bytearray([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,192,192,192,192,240,240,240,240,252,252,240,240,240,240,192,192,192,192,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,48,48,60,36,35,51,63,63,63,63,63,63,60,44,39,55,55,39,44,60,63,63,63,63,63,63,63,63,63,63,60,60,48,48,0,0]) + +mametchienergie1 = bytearray([0,0,0,0,0,96,96,0,0,0,24,228,2,2,2,2,4,152,160,160,160,160,160,160,184,132,130,130,2,228,60,0,0,0,96,96,0,0,0,0, + 0,0,0,6,198,192,0,0,0,60,255,255,247,251,251,251,27,23,31,31,31,31,31,23,251,251,251,247,239,255,254,124,0,0,0,128,140,12,0,0, + 0,0,0,0,0,0,0,0,3,7,14,253,249,251,255,255,255,254,252,252,252,252,254,255,255,255,255,251,57,28,14,6,0,0,0,1,1,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,15,31,31,15,7,7,7,7,7,7,7,7,7,15,31,31,15,0,0,0,0,0,0,0,0,0,0,0,0]) + +mametchifull1 = bytearray([0,0,0,0,0,0,0,0,0,0,0,128,64,60,2,2,2,2,2,124,64,64,124,2,2,2,2,2,60,192,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,60,255,254,238,247,247,247,247,111,127,127,127,127,127,239,247,247,246,246,236,252,255,124,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,1,243,255,63,255,255,31,255,255,255,31,255,255,63,255,255,243,3,1,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,3,15,31,30,14,7,7,7,7,7,14,30,31,15,3,0,0,0,0,0,0,0,0,0,0,0,0,0]) +mametchifull2 = bytearray([0,0,0,0,0,0,0,0,0,0,0,140,122,2,2,2,2,12,112,64,64,64,96,16,12,2,2,2,132,120,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,60,255,238,246,246,246,246,247,47,63,63,63,63,63,47,246,246,246,238,223,255,254,124,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,192,224,241,251,127,255,255,255,255,254,254,254,254,254,255,255,255,223,191,123,241,96,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,1,1,14,31,31,15,7,7,7,7,7,7,7,15,31,31,15,1,0,0,0,0,0,0,0,0,0,0,0,0]) +mametchifull3 = bytearray([0,0,0,0,0,0,0,0,0,0,24,228,2,2,2,2,4,152,160,160,160,160,160,160,184,132,130,130,2,228,60,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,60,255,255,247,251,251,251,27,23,31,31,31,31,31,23,251,251,251,247,239,255,254,124,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,3,7,14,253,249,251,255,255,255,254,252,252,252,252,254,255,255,255,255,251,57,28,14,6,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,15,31,31,15,7,7,7,7,7,7,7,7,7,15,31,31,15,0,0,0,0,0,0,0,0,0,0,0,0]) + +mametchimedium1 = bytearray([0,0,0,0,0,0,0,0,0,0,0,248,6,1,1,1,1,30,32,64,64,64,64,124,6,1,1,1,2,4,120,128,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,124,255,254,198,187,125,5,1,131,255,255,255,255,255,131,5,5,125,187,199,255,254,127,62,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,192,224,241,251,127,255,255,255,255,255,252,253,252,255,255,255,255,223,191,123,241,96,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,1,1,14,31,31,15,3,3,3,3,3,3,3,3,15,31,31,15,0,0,0,0,0,0,0,0,0,0,0,0]) +mametchimedium2 = bytearray([0,0,0,0,0,0,0,192,32,32,0,128,124,2,1,1,1,2,4,120,64,64,64,112,14,1,1,1,1,2,124,128,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,3,0,0,124,255,255,199,187,125,5,1,131,255,255,255,255,255,131,5,5,125,187,199,255,254,127,62,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,1,3,227,187,127,111,158,253,253,253,254,255,255,255,247,195,3,1,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,3,7,7,3,3,3,3,3,3,3,3,3,7,15,31,28,0,0,17,14,0,0,0,0,0,0,0]) +mametchimedium3 = bytearray([0,0,0,0,0,0,0,0,0,0,0,128,124,2,1,1,1,2,60,64,64,64,64,124,6,1,1,1,2,4,120,128,0,0,64,128,0,0,0,0, + 0,0,0,0,0,0,0,0,0,124,255,254,198,187,125,5,1,131,255,255,255,255,255,131,5,5,125,187,199,255,254,127,62,0,0,32,31,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,1,3,195,247,255,255,255,254,253,253,253,254,159,111,127,191,227,3,1,0,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,14,17,0,0,28,31,15,7,3,3,3,3,3,3,3,3,3,3,7,7,3,0,0,0,0,0,0,0,0,0,0,0]) + +mametchilow1 = bytearray([98,82,74,70,0,0,200,168,152,0,128,112,12,2,1,1,1,1,2,124,64,64,124,6,1,1,1,1,2,124,128,0,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,120,254,255,255,255,239,239,239,255,255,254,254,254,254,254,254,238,238,238,252,252,252,252,255,124,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,1,3,7,7,15,143,239,127,255,223,63,252,255,127,191,255,127,239,143,7,3,3,1,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,28,63,63,31,14,6,7,7,7,6,5,13,30,63,63,28,0,0,0,0,0,0,0,0,0,0,0]) +mametchilow2 = bytearray([0,0,0,0,0,0,0,0,0,0,0,128,124,2,1,1,1,1,6,124,64,64,124,2,1,1,1,1,2,12,112,128,0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,124,255,252,252,252,252,254,230,254,254,254,254,254,254,254,255,255,231,255,255,255,255,255,254,120,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,1,3,3,7,143,239,127,255,191,127,248,248,56,223,255,63,239,143,15,7,7,3,1,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,0,0,0,28,63,63,30,13,5,6,7,7,7,6,14,31,63,63,28,0,0,0,0,0,0,0,0,0,0,0]) + +mametchisad1 = bytearray([0,0,0,0,0,0,0,0,0,0,224,16,12,4,4,3,1,1,2,28,32,32,64,64,32,16,8,4,2,2,2,2,4,12,240,0,0,0,0,0, + 0,0,0,0,0,0,0,0,192,224,248,253,183,178,176,176,176,176,208,224,224,224,224,224,224,224,192,160,160,160,160,160,160,227,252,240,0,0,0,0, + 0,0,0,0,0,0,0,0,3,7,15,159,223,223,157,248,189,157,159,143,143,143,143,159,159,189,184,189,189,175,183,59,27,15,7,1,0,0,0,0, + 0,0,0,0,0,0,0,0,0,0,12,29,61,61,61,63,31,31,31,31,31,31,31,31,31,31,31,24,55,55,57,60,30,12,0,0,0,0,0,0]) +mametchisad2 = bytearray([0,0,0,0,96,96,124,252,240,48,48,0,0,0,0,0,0,128,192,192,224,224,224,224,224,224,224,192,192,128,128,0,12,12,124,127,31,24,24,0, + 0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,252,255,243,255,255,15,247,251,255,255,255,255,255,255,255,0,1,6,8,8,8,16,16,224,0, + 0,0,0,0,224,248,252,248,255,255,255,248,254,252,248,7,255,255,255,255,255,254,255,255,255,255,255,255,255,1,0,0,0,28,20,20,20,22,35,192, + 12,30,30,30,63,63,63,63,63,63,63,63,63,63,63,28,19,15,31,31,31,63,63,63,63,63,63,47,39,32,32,32,16,16,16,16,16,16,16,15]) + + +# BITMAP: width: 15, height: 13 +heart1 = bytearray([60,126,231,243,251,255,254,252,254,255,255,255,255,126,60, + 0,0,0,1,3,7,15,31,15,7,3,1,0,0,0]) +heart2 = bytearray([0,60,102,242,250,254,252,248,252,254,254,254,126,60,0, + 0,0,0,0,1,3,7,15,7,3,1,0,0,0,0]) +heart3 = bytearray([0,0,56,108,244,252,248,240,248,252,252,124,56,0,0, + 0,0,0,0,0,1,3,7,3,1,0,0,0,0,0]) + +# BITMAP: width: 7, height: 7 +heartFull = bytearray([14,25,63,126,63,31,14]) + +eggSpr = thumby.Sprite(32, 38, egg2+egg1, 20, 1) +eggcrackSpr = thumby.Sprite(32, 38, eggcrack2+eggcrack1, 20, 1) +eggopenSpr = thumby.Sprite(60, 40, eggopen1+eggopen1+eggopen2+eggopen2+eggopen3+eggopen3+eggopen4+eggopen4, 5, 1) +babyenergieSpr = thumby.Sprite(30, 30, babyenergie1+babyenergie2, 20, 15) +babymediumSpr = thumby.Sprite(30, 30, babymedium1+babymedium2+babymedium3+babymedium4+babymedium5+babymedium6+babymedium7+babymedium8+babymedium9+babymedium10, 20, 15) +babylowSpr = thumby.Sprite(30, 30, babylow1+babylow2, 20, 15) +babyfullSpr = thumby.Sprite(30, 30, babyfull1+babyfull2+babyfull3+babyfull2, 20, 15) +babysadSpr = thumby.Sprite(30, 30, babysad1+babysad1+babysad2+babysad2, 20, 15) +poopenergieSpr = thumby.Sprite(40, 30, poopenergie1+poopenergie2, 15, 10) +poopfullSpr = thumby.Sprite(40, 30, poopfull1+poopfull2, 15, 10) +poopmediumSpr = thumby.Sprite(40, 30, poopmedium1+poopmedium2, 15, 10) +pooplowSpr = thumby.Sprite(40, 30, pooplow1+pooplow2, 15, 10) +poopsadSpr = thumby.Sprite(40, 30, poopsad1+poopsad1+poopsad2+poopsad2, 15, 10) +mametchienergieSpr = thumby.Sprite(40, 30, mametchifull1+mametchifull2+mametchienergie1+mametchifull2, 15, 9) +mametchifullSpr = thumby.Sprite(40, 30, mametchifull1+mametchifull2+mametchifull3+mametchifull2, 15, 9) +mametchimediumSpr = thumby.Sprite(40, 30, mametchimedium1+mametchimedium2+mametchimedium1+mametchimedium3, 15, 9) +mametchilowSpr = thumby.Sprite(40, 30, mametchilow1+mametchilow1+mametchilow1+mametchilow2+mametchilow2+mametchilow2, 15, 9) +mametchsadSpr = thumby.Sprite(40, 30, mametchisad1+mametchisad1+mametchisad1+mametchisad2+mametchisad2+mametchisad2, 15, 9) + +heartSpr = thumby.Sprite(15, 13, heart1+heart2+heart3+heart2, 2, 2) + +heartFull1Spr = thumby.Sprite(7, 7, heartFull, 0, 0) +heartFull2Spr = thumby.Sprite(7, 7, heartFull, 8, 0) +heartFull3Spr = thumby.Sprite(7, 7, heartFull, 16, 0) +heartFull4Spr = thumby.Sprite(7, 7, heartFull, 24, 0) +heartFull5Spr = thumby.Sprite(7, 7, heartFull, 32, 0) +heartFull6Spr = thumby.Sprite(7, 7, heartFull, 40, 0) + +# BITMAP: width: 11, height: 5 +batt0 = bytearray([31,17,17,17,17,17,17,17,17,27,14]) +batt1 = bytearray([31,31,31,31,17,17,17,17,17,27,14]) +batt2 = bytearray([31,31,31,31,31,31,31,17,17,27,14]) +batt3 = bytearray([31,31,31,31,31,31,31,31,31,31,14]) +charg = bytearray([31,31,27,27,9,0,18,27,27,31,14]) +emula = bytearray([31,21,17,0,31,2,31,0,31,16,31]) + +# BITMAP: width: 16, height: 16 +sun1 = bytearray([192,192,12,12,192,192,51,51,48,48,192,192,12,12,0,0, + 0,0,48,48,3,3,12,12,204,204,3,3,48,48,3,3]) +sun2 = bytearray([0,0,12,12,192,192,48,48,51,51,192,192,12,12,192,192, + 3,3,48,48,3,3,204,204,12,12,3,3,48,48,0,0]) + +sunleftSpr = thumby.Sprite(16, 16, sun1+sun2, 0, 20) +sunrightSpr = thumby.Sprite(16, 16, sun1+sun2, 54, 20) + +iconx = 61 +icony = 0 +iconw = 11 +iconh = 5 +b=charging + +def showHearts(): + if hearts > 0: + thumby.display.drawSprite(heartFull1Spr) + if hearts > 1: + thumby.display.drawSprite(heartFull2Spr) + if hearts > 2: + thumby.display.drawSprite(heartFull3Spr) + if hearts > 3: + thumby.display.drawSprite(heartFull4Spr) + if hearts > 4: + thumby.display.drawSprite(heartFull5Spr) + if hearts > 5: + thumby.display.drawSprite(heartFull6Spr) + +def showSun(): + sunleftSpr.setFrame(frameCtr) + thumby.display.drawSprite(sunleftSpr) + sunrightSpr.setFrame(frameCtr) + thumby.display.drawSprite(sunrightSpr) + +def NewEgg(): + frameCtr = 0 + counter = 0 + thumby.display.setFPS(2) + while(counter < 50): + thumby.display.fill(1) + eggSpr.setFrame(frameCtr) + thumby.display.drawSprite(eggSpr) + thumby.display.update() + thumby.audio.play(200,100) + frameCtr += 1 + counter += 1 + while(counter < 100): + thumby.display.setFPS(4) + thumby.display.fill(1) + eggcrackSpr.setFrame(frameCtr) + thumby.display.drawSprite(eggcrackSpr) + thumby.display.update() + thumby.audio.play(300,100) + frameCtr += 1 + counter += 1 + counter = 0 + frameCtr = 0 + while(counter < 8): + thumby.audio.play(400,50) + thumby.display.setFPS(2) + thumby.display.fill(1) + eggopenSpr.setFrame(frameCtr) + thumby.display.drawSprite(eggopenSpr) + thumby.display.update() + frameCtr += 1 + counter += 1 + +if hearts > 6: + hearts = -1 + +if hearts == -1: + NewEgg() + hearts = 0 + score = 0 + stage = 0 + thumby.saveData.setItem('hearts', hearts) + thumby.saveData.setItem('score', score) + thumby.saveData.setItem('stage', stage) + thumby.saveData.save() + +hungry = 4 +frameCtr = 0 + +while (not thumby.buttonA.pressed()): + thumby.display.setFPS(4) + thumby.display.fill(0) + in_emu=not hasattr(thumby.display.display,"cs") + if (in_emu): + thumby.display.blit(emula,iconx,icony,iconw,iconh,-1,0,0) + else: + v=adc.read_u16() + b=min(b,v) + if (v > charging): + thumby.display.blit(charg,iconx,icony,iconw,iconh,-1,0,0) + if stage == 0: + babyenergieSpr.setFrame(frameCtr) + thumby.display.drawSprite(babyenergieSpr) + if stage == 1: + poopenergieSpr.setFrame(frameCtr) + thumby.display.drawSprite(poopenergieSpr) + if stage == 2: + mametchienergieSpr.setFrame(frameCtr) + thumby.display.drawSprite(mametchienergieSpr) + if hungry == 1: + hungry = 100 + hearts += 1 + score += 1 + charges +=1 + thumby.saveData.setItem('score', score) + thumby.saveData.setItem('hearts', hearts) + thumby.saveData.setItem('charges', charges) + thumby.saveData.save() + if hungry == 0: + hungry = 100 + hearts += 1 + score += 2 + charges +=1 + thumby.saveData.setItem('score', score) + thumby.saveData.setItem('hearts', hearts) + thumby.saveData.setItem('charges', charges) + thumby.saveData.save() + if (hungry == 2) or (hungry == 3): + thumby.display.fill(0) + thumby.display.drawText("I am not!", 10, 5, 1) + thumby.display.drawText("hungry!", 17, 16, 1) + thumby.display.drawText("Damn!", 22, 28, 1) + thumby.audio.play(100,500) + hungry = 4 + if stage < 2: + score = hearts + else: + score = hearts + 11 + thumby.saveData.setItem('score', score) + thumby.saveData.save() + thumby.display.update() + while(thumby.actionPressed() == False): + pass + time.sleep(0.5) + if hungry == 100: + heartSpr.setFrame(frameCtr) + thumby.display.drawSprite(heartSpr) + else: + showHearts() + if score > 21: + showSun() + if hearts == 7: + if score < 11: + stage = 1 + hearts = 0 + score = 0 + thumby.saveData.setItem('score', score) + thumby.saveData.setItem('stage', stage) + thumby.saveData.setItem('hearts', hearts) + thumby.saveData.save() + thumby.display.fill(0) + thumby.display.drawText("Try better!", 3, 5, 1) + thumby.display.drawText("Holy", 22, 17, 1) + thumby.display.drawText("SHIT!", 20, 28, 1) + thumby.audio.play(100,500) + thumby.display.update() + while(thumby.actionPressed() == False): + pass + time.sleep(0.5) + if (score > 10) and (stage < 2): + stage = 2 + hearts = 0 + thumby.saveData.setItem('stage', stage) + thumby.saveData.setItem('hearts', hearts) + thumby.saveData.save() + thumby.display.fill(0) + thumby.display.drawText("Well done!", 8, 5, 1) + thumby.display.drawText("Your pet", 10, 19, 1) + thumby.display.drawText("envolved!", 9, 30, 1) + thumby.audio.play(1000,500) + thumby.display.update() + while(thumby.actionPressed() == False): + pass + time.sleep(0.5) + if score > 17: + thumby.display.fill(0) + if score > 21: + thumby.display.drawText("**********", 6, 5, 1) + thumby.display.drawText("Exellent!!", 6, 17, 1) + thumby.display.drawText("**********", 6, 28, 1) + thumby.display.update() + while(thumby.actionPressed() == False): + pass + time.sleep(0.5) + thumby.display.fill(0) + thumby.display.drawText("**********", 6, 1, 1) + thumby.display.drawText("Mametchi", 12, 12, 1) + thumby.display.drawText("is happy!", 9, 23, 1) + thumby.display.drawText("**********", 6, 34, 1) + thumby.audio.play(1000,500) + pets += 1 + thumby.saveData.setItem('pets', pets) + thumby.saveData.save() + else: + thumby.display.drawText("Well done!", 8, 5, 1) + thumby.display.drawText("But you can", 3, 19, 1) + thumby.display.drawText("do better!", 6, 30, 1) + thumby.audio.play(100,500) + thumby.display.update() + while(thumby.actionPressed() == False): + pass + time.sleep(0.5) + thumby.display.fill(0) + thumby.display.drawText("Your pet", 10, 2, 1) + thumby.display.drawText("grows up", 10, 12, 1) + thumby.display.drawText("and leaves", 6, 22, 1) + thumby.display.drawText("its home!", 9, 32, 1) + thumby.display.update() + while(thumby.actionPressed() == False): + pass + time.sleep(0.5) + thumby.display.fill(0) + thumby.display.drawText("**********", 6, 1, 1) + thumby.display.drawText("You got a", 9, 12, 1) + thumby.display.drawText("new EGG!", 12, 23, 1) + thumby.display.drawText("**********", 6, 34, 1) + thumby.display.update() + while(thumby.actionPressed() == False): + pass + time.sleep(0.5) + NewEgg() + hearts = 0 + score = 0 + stage = 0 + thumby.saveData.setItem('score', score) + thumby.saveData.setItem('stage', stage) + thumby.saveData.setItem('hearts', hearts) + thumby.saveData.save() + frameCtr += 1 + b=v + else: + if (b > level_3): + thumby.display.blit(batt3,iconx,icony,iconw,iconh,-1,0,0) + if stage == 0: + babyfullSpr.setFrame(frameCtr) + thumby.display.drawSprite(babyfullSpr) + if stage == 1: + poopfullSpr.setFrame(frameCtr) + thumby.display.drawSprite(poopfullSpr) + if stage == 2: + mametchifullSpr.setFrame(frameCtr) + thumby.display.drawSprite(mametchifullSpr) + showHearts() + if score > 21: + showSun() + hungry = 3 + frameCtr += 1 + elif (b > level_2): + thumby.display.blit(batt2,iconx,icony,iconw,iconh,-1,0,0) + if stage == 0: + babymediumSpr.setFrame(frameCtr) + thumby.display.drawSprite(babymediumSpr) + if stage == 1: + poopmediumSpr.setFrame(frameCtr) + thumby.display.drawSprite(poopmediumSpr) + if stage == 2: + mametchimediumSpr.setFrame(frameCtr) + thumby.display.drawSprite(mametchimediumSpr) + showHearts() + if score > 21: + showSun() + hungry = 2 + frameCtr += 1 + elif (b > level_1): + thumby.display.blit(batt1,iconx,icony,iconw,iconh,-1,0,0) + if stage == 0: + babylowSpr.setFrame(frameCtr) + thumby.display.drawSprite(babylowSpr) + if stage == 1: + pooplowSpr.setFrame(frameCtr) + thumby.display.drawSprite(pooplowSpr) + if stage == 2: + mametchilowSpr.setFrame(frameCtr) + thumby.display.drawSprite(mametchilowSpr) + showHearts() + if score > 21: + showSun() + frameCtr += 1 + hungry = 1 + else: + thumby.display.blit(batt0,iconx,icony,iconw,iconh,-1,0,0) + if stage == 0: + babysadSpr.setFrame(frameCtr) + thumby.display.drawSprite(babysadSpr) + if stage == 1: + poopsadSpr.setFrame(frameCtr) + thumby.display.drawSprite(poopsadSpr) + if stage == 2: + mametchsadSpr.setFrame(frameCtr) + thumby.display.drawSprite(mametchsadSpr) + showHearts() + hungry = 0 + frameCtr += 1 + while thumby.buttonU.pressed(): + thumby.display.fill(0) + thumby.display.drawText("Current", 17, 6, 1) + thumby.display.drawText("Pet Score:", 8, 17, 1) + pixelLength = len(str(score)) * 5 + offset = int((thumby.display.width - pixelLength) / 2) + thumby.display.drawText(str(score), offset, 28, 1) + thumby.display.update() + pass + while thumby.buttonL.pressed(): + thumby.display.fill(0) + thumby.display.drawText("Feed your", 9, 2, 1) + thumby.display.drawText("hungry pet", 6, 12, 1) + pixelLength = len(str(charges)) * 5 + offset = int((thumby.display.width - pixelLength) / 2) + thumby.display.drawText(str(charges), offset, 22, 1) + thumby.display.drawText("times!", 19, 32, 1) + thumby.display.update() + pass + while thumby.buttonR.pressed(): + thumby.display.fill(0) + thumby.display.drawText("Raise happy", 3, 2, 1) + thumby.display.drawText("Mametchi", 13, 12, 1) + pixelLength = len(str(pets)) * 5 + offset = int((thumby.display.width - pixelLength) / 2) + thumby.display.drawText(str(pets), offset, 22, 1) + thumby.display.drawText("times!", 19, 32, 1) + thumby.display.update() + pass + while thumby.buttonD.pressed(): + thumby.display.fill(0) + thumby.display.drawText("Hello", 19, 10, 1) + thumby.display.drawText("Friend!", 15, 21, 1) + thumby.display.update() + pass + while (thumby.buttonB.pressed()): + thumby.display.fill(0) + v=adc.read_u16() + b=min(b,v) + thumby.display.drawText("v=%d" % b, 0, 0, 1) + if (v > charging): + thumby.display.blit(charg,iconx,icony,iconw,iconh,-1,0,0) + thumby.display.drawText("AC", 30, 22, 1) + else: + if (b > level_3): + thumby.display.blit(batt3,iconx,icony,iconw,iconh,-1,0,0) + thumby.display.drawText("Full", 25, 22, 1) + elif (b > level_2): + thumby.display.blit(batt2,iconx,icony,iconw,iconh,-1,0,0) + thumby.display.drawText("Medium", 20, 22, 1) + elif (b > level_1): + thumby.display.blit(batt1,iconx,icony,iconw,iconh,-1,0,0) + thumby.display.drawText("Low", 26, 22, 1) + else: + thumby.display.blit(batt0,iconx,icony,iconw,iconh,-1,0,0) + thumby.display.drawText("Very Low", 12, 22, 1) + thumby.display.update() + thumby.display.update() diff --git a/BatteryPet/arcade_description.txt b/BatteryPet/arcade_description.txt new file mode 100644 index 0000000..94a2f8a --- /dev/null +++ b/BatteryPet/arcade_description.txt @@ -0,0 +1,10 @@ +Raise a virtual pet. +Open 'BatteryPet' to check the battery status. +Press B for the charging level. +Press the direction pad for details. +Press A to exit. +Plugin the charging cabel with the App open. +Use it to feed your pet when Thumby is low or very low. +After feeding you can exit the App or turn off Thumby. +Let a happy Memetchi grow up. +Maybe you get a Poop. diff --git a/BatteryPet/arcade_title_video.webm b/BatteryPet/arcade_title_video.webm new file mode 100644 index 0000000..17c1dbc Binary files /dev/null and b/BatteryPet/arcade_title_video.webm differ