For my creative task 8 in CMU CS Academy, I am recreating the pickpocket minigame from Assassin's Creed: Altair's Chronicles. However, in that minigame, you tap to reveal a circular area in the black screen. I realized that I don't know any way to make a hole in a shape (In this case, app.overlay). I need a way to reveal parts of the screen.
I asked my classmates and teacher. None had any idea of how to perform this. I have the idea to make a bunch of tiny objects, and remove ones touching a shape following the mouse on click, but I don't know how to set up such a system.
Here is my code:
# Fill me in!
app.background = 'black'
app.sackLeftHanded = Polygon(8, 90, 36, 39, 96, 23, 218, 12, 294, 39, 324, 0, 340, 23, 369, 41, 396, 39, 368, 126, 393, 196, 386, 303, 374, 363, 304, 380, 148, 377, 62, 343, 28, 283, fill=gradient(rgb(187, 149, 89), rgb(52, 22, 11)), visible=False)
app.sackRightHanded = Polygon(392, 90, 364, 39, 304, 23, 182, 12, 106, 39, 76, 0, 60, 23, 31, 41, 4, 39, 32, 126, 7, 196, 14, 303, 26, 363, 96, 380, 252, 377, 338, 343, 368, 278, fill=gradient(rgb(187, 149, 89), rgb(52, 22, 11)), visible=False)
app.liningLeft = Group(Line(275, 45, 230, 32, lineWidth=5), Line(210, 32, 123, 34, lineWidth=5), Line(95, 36, 45, 50, lineWidth=5), Line(36, 67, 21, 121, lineWidth=5), Line(27, 143, 27, 181, lineWidth=5), Line(30, 202, 33, 250, lineWidth=5), Line(40, 266, 143, 354, lineWidth=5), Line(172, 358, 303, 358, lineWidth=5), Line(324, 329, 368, 254, lineWidth=5), Line(367, 214, 353, 146, lineWidth=5))
app.liningLeft.visible = False
app.winScreen = Group(Line(0, 200, 400, 200, fill=gradient(rgb(125, 2, 12), rgb(125, 2, 12), rgb(69, 0, 0), start='top'), lineWidth=70), Line(0, 160, 400, 160, lineWidth=10, fill=rgb(218, 194, 157)), Line(0, 240, 400, 240, lineWidth=10, fill=rgb(218, 194, 157)), Label("You Win!", 200, 195, size=40, font='cinzel', fill=gradient('white','lightGray', start='top'), border='black', bold=True, borderWidth=3))
app.winScreen.visible = False
app.overlay = Rect(0, 0, 400, 400)
app.counterLabel = Label("GO!", 200, 200, size=100, font='cinzel', fill=rgb(212, 210, 220), border=rgb(103,60, 16), visible=False)
app.isLeftHanded = None
leftHandCheck = Group(Line(120, 208, 136, 226, fill='limeGreen', lineWidth=10), Line(132, 228, 172, 186, fill='limeGreen', lineWidth=10), visible=False)
rightHandX = Group(Line(224, 181, 261, 225, fill=rgb(199, 14, 18), lineWidth=10), Line(261, 181, 224, 225, fill=rgb(199, 14, 18), lineWidth=10), visible=False)
aYLHLabel = Label("ARE YOU LEFT-HANDED?", 200, 130, fill='white', size=20)
def askLeftHand():
leftHandCheck.toFront()
leftHandCheck.visible = True
rightHandX.toFront()
rightHandX.visible = True
def onMousePress(x, y):
if leftHandCheck.hits(x, y):
app.sackLeftHanded.visible = True
app.liningLeft.visible = True
start()
if rightHandX.hits(x, y):
app.sackRightHanded.visible = True
start()
def start():
leftHandCheck.visible = False
rightHandX.visible = False
aYLHLabel.visible = False
app.counterLabel.visible = True
app.counterLabel.value = "3"
sleep(0.2)
app.counterLabel.value = "2"
sleep(0.2)
app.counterLabel.value = "1"
sleep(0.2)
app.counterLabel.value = "GO!"
sleep(0.2)
app.counterLabel.visible = False
app.overlay.visible = False
askLeftHand()