Skip to content

Commit

Permalink
Merge pull request #242 from BBfiChe/master
Browse files Browse the repository at this point in the history
Add Flashlight Game and update Microsquareroot calculator
  • Loading branch information
TinyCircuits authored Jul 1, 2024
2 parents 686b8ab + 5b62a11 commit 0cc0b4b
Show file tree
Hide file tree
Showing 5 changed files with 128 additions and 89 deletions.
52 changes: 52 additions & 0 deletions Flashlight/Flashlight.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
import thumby
import time

# A-Flashlight.py

black = bytearray([255, 233, 207, 9, 15, 9, 207, 233,
3, 3, 3, 0, 0, 0, 3, 3])

white = bytearray([0, 22, 48, 246, 240, 246, 48, 22,
0, 0, 0, 3, 3, 3, 0, 0])

# BITMAP: width: 8, height: 10
off_flashlight = bytearray([0,16,48,240,240,240,48,16,
0,0,0,3,3,3,0,0])

version = bytearray([255, 233, 207, 9, 15, 9, 207, 233,
3, 3, 3, 0, 0, 0, 3, 3])


# BITMAP: width: 8, height: 8
copyright = bytearray([255,129,189,165,165,165,129,255])

clicks = 1
fill = 1

while True:
thumby.display.fill(fill)
thumby.display.blit(version, 0, 31, 8, 8, -1, 0, 0)

if thumby.buttonA.justPressed():
if fill == 1:
fill = 0
version = bytearray([0,16,48,240,240,240,48,16,
0,0,0,3,3,3,0,0])
else:
fill = 1
version = bytearray([255, 233, 207, 9, 15, 9, 207, 233,
3, 3, 3, 0, 0, 0, 3, 3])

if thumby.buttonB.justPressed():
if clicks == 1:
thumby.display.fill(0)
thumby.display.drawText("Exiting...", 5, 10, 1)
thumby.display.drawText(" BBfiChe", 3, 25, 1)
thumby.display.blit(copyright, 4, 25, 8, 8, -1, 0, 0)
thumby.display.update()
time.sleep(3)
thumby.reset()
else:
clicks += 1

thumby.display.update()
11 changes: 11 additions & 0 deletions Flashlight/arcade_description.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
A simple flashlight script so that you have a mini flashlight to help you find things under your couch or something, I'm not sure I just made this for fun lol
-------------------
Created by @BBfiChe on Discord
-------------------
Updates:
-------------------
Update 1.0.1
- Updated dark screen flashlight to appear off instead of on.

Update 1.0.0
- Added Flashlight game.
Binary file added Flashlight/arcade_title_video.webm
Binary file not shown.
147 changes: 60 additions & 87 deletions MicroSquareRootCalc/MicroSquareRootCalc.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
BBfiChe_logo = bytearray([0,254,254,6,250,250,250,6,250,250,250,6,254,250,250,2,250,250,254,2,250,250,250,254,2,234,234,18,254,2,250,250,250,250,250,2,254,254,254,254,2,254,254,194,190,190,194,254,254,2,254,2,186,186,186,186,186,70,254,0,
0,255,255,252,255,255,135,180,183,183,183,52,255,253,5,244,245,245,247,4,253,253,5,183,180,183,71,252,255,244,245,245,5,245,245,244,255,255,255,255,0,255,255,255,185,128,191,255,255,0,255,8,107,107,107,107,107,108,255,0,
0,255,255,255,255,255,13,237,237,237,237,252,31,111,108,109,29,253,253,12,251,255,252,255,255,15,236,239,239,239,239,255,252,255,255,255,255,255,255,255,0,255,255,255,7,116,4,255,255,0,255,232,235,235,11,235,235,235,255,0,
0,255,95,95,223,223,80,215,87,215,87,223,80,95,223,223,80,95,223,208,87,87,87,215,95,80,87,215,87,87,87,223,95,223,95,223,95,95,95,255,0,255,159,15,255,9,233,15,255,0,255,31,111,111,104,111,111,31,255,0,
0,127,64,91,100,127,124,67,124,127,68,127,64,91,100,127,64,91,100,127,64,125,127,127,95,64,95,127,64,95,95,127,64,123,64,127,64,91,91,127,64,127,123,120,123,120,123,120,127,64,127,112,127,127,127,127,127,112,127,0])
0,255,95,95,223,223,80,215,87,215,87,223,80,95,223,223,80,95,223,208,87,87,87,215,95,80,87,215,87,87,87,223,95,223,95,223,95,95,95,255,0,223,239,239,15,249,9,239,15,0,255,31,111,111,104,111,111,31,255,0,
0,127,64,91,100,127,124,67,124,127,68,127,64,91,100,127,64,91,100,127,64,125,127,127,95,64,95,127,64,95,95,127,64,123,64,127,64,91,91,127,64,123,121,122,122,127,120,123,120,64,127,112,127,127,127,127,127,112,127,0])
# BITMAP: width: 15, height: 9
sel_side = bytearray([255,1,1,1,1,1,1,1,1,1,1,1,1,1,255,
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1])
Expand All @@ -33,34 +33,26 @@
num = 0
dec_chk = False
exit = True
time_intro = 3
#Function to check which box is checked:
def appendnum(num):
global selx, sely, result
val = ''.join(map(str, result))
result.clear()
result.append(int(val+ str(num)))

def xyplacmntchk():
global selx, sely, result, num
global selx, sely, result, num, time_intro
if selx == 0 and sely == 0:
num = 1
val = ''.join(map(str, result))
result.clear()
result.append(int(val + str(num)))
appendnum(1)
elif selx == 8 and sely == 0:
num = 2
val = ''.join(map(str, result))
result.clear()
result.append(int(val + str(num)))
appendnum(2)
elif selx == 16 and sely == 0:
num = 3
val = ''.join(map(str, result))
result.clear()
result.append(int(val + str(num)))
appendnum(3)
elif selx == 24 and sely == 0:
num = 4
val = ''.join(map(str, result))
result.clear()
result.append(int(val + str(num)))
appendnum(4)
elif selx == 32 and sely == 0:
num = 5
val = ''.join(map(str, result))
result.clear()
result.append(int(val + str(num)))
appendnum(5)
elif selx == 40 and sely == 0:
if result == []:
pass
Expand All @@ -69,63 +61,54 @@ def xyplacmntchk():
time.sleep(0.2)
# BOTTOM ROW CHECK
elif selx == 0 and sely == 8:
num = 6
val = ''.join(map(str, result))
result.clear()
result.append(int(val + str(num)))
appendnum(6)
elif selx == 8 and sely == 8:
num = 7
val = ''.join(map(str, result))
result.clear()
result.append(int(val + str(num)))
appendnum(7)
elif selx == 16 and sely == 8:
num = 8
val = ''.join(map(str, result))
result.clear()
result.append(int(val + str(num)))
appendnum(8)
elif selx == 24 and sely == 8:
num = 9
val = ''.join(map(str, result))
result.clear()
result.append(int(val + str(num)))
appendnum(9)
elif selx == 32 and sely == 8:
num = 0
val = ''.join(map(str, result))
result.clear()
result.append(int(val + str(num)))
appendnum(0)
elif selx == 40 and sely == 8:
time_intro = 2
intro()
else:
pass

thumby.display.fill(0)
thumby.display.blit(BBfiChe_logo,6,0,60,40,0,0,0)
thumby.display.update()
time.sleep(5)
def intro():
global time_intro
thumby.display.fill(0)
thumby.display.blit(BBfiChe_logo,6,0,60,40,0,0,0)
thumby.display.update()
time.sleep(time_intro)
thumby.display.fill(0)
thumby.display.drawText("Keybinds:",3,1,1)
thumby.display.drawText("----------------",5,6,1)
thumby.display.setFont("/lib/font5x7.bin", 5, 7, 1)
thumby.display.drawText("To Exit:",2,13,1)
thumby.display.drawText("Hold A+B",2,22,1)
thumby.display.update()
thumby.display.setFont("/lib/font3x5.bin", 3, 5, 1)
time.sleep(time_intro)
thumby.display.fill(0)
thumby.display.drawText("Keybinds:",3,1,1)
thumby.display.drawText("----------------",5,6,1)
thumby.display.setFont("/lib/font5x7.bin", 5, 7, 1)
thumby.display.drawText("Move around:",2,9,1)
thumby.display.drawText("Left,Right,",1,17,1)
thumby.display.drawText("Up,Down",1,25,1)
thumby.display.drawText("Buttons",2,33,1)
thumby.display.update()
thumby.display.setFont("/lib/font3x5.bin", 3, 5, 1)
time.sleep(time_intro)

intro()

thumby.display.fill(0)
thumby.display.drawText("Keybinds:",3,1,1)
thumby.display.drawText("----------------",5,6,1)
thumby.display.setFont("/lib/font5x7.bin", 5, 7, 1)
thumby.display.drawText("To Exit:",2,13,1)
thumby.display.drawText("Hold A+B",2,22,1)
thumby.display.update()
thumby.display.setFont("/lib/font3x5.bin", 3, 5, 1)
time.sleep(5)
thumby.display.fill(0)
thumby.display.drawText("Keybinds:",3,1,1)
thumby.display.drawText("----------------",5,6,1)
thumby.display.setFont("/lib/font5x7.bin", 5, 7, 1)
thumby.display.drawText("Move around:",2,9,1)
thumby.display.drawText("Left,Right,",1,17,1)
thumby.display.drawText("Up,Down",1,25,1)
thumby.display.drawText("Buttons",2,33,1)
thumby.display.update()
thumby.display.setFont("/lib/font3x5.bin", 3, 5, 1)
time.sleep(5)
#Main Code to run:
while True:
thumby.display.blit(microsqrtcalc_logo,47 ,1 ,22 ,17 ,-1 ,0 ,0)
thumby.display.drawText("1 2 3 4 5 <",2,2,1)
thumby.display.drawText("6 7 8 9 0",2,10,1)
thumby.display.drawText("6 7 8 9 0 i",2,10,1)
thumby.display.drawText("Results:",8,18,1)
thumby.display.drawText(f"Inpt:{result}",1,25,1)
thumby.display.drawText(f"Out:{output}",1,31,1)
Expand All @@ -135,21 +118,16 @@ def xyplacmntchk():
if result:
output = sqrt(int(''.join(map(str, result))))
#-----------------------------------------
if thumby.buttonR.pressed():
if thumby.buttonR.justPressed():
selx += 8
time.sleep(0.2)
if thumby.buttonL.pressed():
if thumby.buttonL.justPressed():
selx -= 8
time.sleep(0.2)
if thumby.buttonD.pressed():
if thumby.buttonD.justPressed():
sely += 8
time.sleep(0.2)
if thumby.buttonU.pressed():
if thumby.buttonU.justPressed():
sely -= 8
time.sleep(0.2)
if thumby.buttonA.pressed():
if thumby.buttonA.justPressed():
xyplacmntchk()
time.sleep(0.2)
if thumby.buttonA.pressed() and thumby.buttonB.pressed():
while True:
thumby.display.fill(0)
Expand All @@ -161,17 +139,15 @@ def xyplacmntchk():
thumby.display.drawText("NO",35,25,1)
thumby.display.drawText("!",44,25,1)
thumby.display.blit(sel_side,sels_x,sels_y,15,9,0,0,0)
if thumby.buttonL.pressed():
if thumby.buttonL.justPressed():
sels_x -= 20
time.sleep(0.2)
if thumby.buttonR.pressed():
if thumby.buttonR.justPressed():
sels_x += 20
time.sleep(0.2)
if sels_x < 12:
sels_x = 13
if sels_x > 35:
sels_x = 33
if thumby.buttonU.pressed():
if thumby.buttonU.justPressed():
if sels_x > 30:
break
if sels_x == 13:
Expand All @@ -187,8 +163,5 @@ def xyplacmntchk():
selx += 8
if sely == 16:
sely -= 8
if selx == 40 and sely == 8:
selx = 32
sely = 8
thumby.display.update()
thumby.display.fill(0)
7 changes: 5 additions & 2 deletions MicroSquareRootCalc/arcade_description.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ Version 1.0.0 Beta:
Version 1.0.10 Beta:
-Added a Exit screen accessed with the calculator
Version 1.0.11 Beta:
Tweaked the keybinds loading screen to have a easier to read 5x7 Thumby font
Version 1.0.20 Beta:
-Tweaked the keybinds loading screen to have a easier to read 5x7 Thumby font
-Tweaked an issue where the selected box when trying to exit the game would overlap the "YES" Button.

Version 1.0.20 Beta:
-Made the code more efficient and less storage intensive by removing a lot of extra code
-Added an info button which replays the intro

0 comments on commit 0cc0b4b

Please sign in to comment.