Last active
April 17, 2018 15:32
-
-
Save PrinnyBaal/418e88ed0e5c87a3136654ac9d4de2c1 to your computer and use it in GitHub Desktop.
BanterMinigame Screen
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
screen dueling: | |
#Setting the 'dismiss' key to something else lets the player play the minigame without messing with the 'banter' | |
#Here I just have it play a sound file to give some feedback if the player outright misses. | |
key 'dismiss' action [Play ("sound", "enchant.ogg")] | |
#text str(hit) size 40 xalign .2 yalign 0.0 color "#f00" (for debugging, displays how many times a 'hit' was registered) | |
# This code creates a healthbar at the bottom of the screen to let the player know how many more times they can | |
#mess up before they lose | |
if hit==0: | |
add shieldUp xcenter .45 ycenter .7 | |
add shieldUp xcenter .50 ycenter .7 | |
add shieldUp xcenter .55 ycenter .7 | |
elif hit==1: | |
add shieldBroken xcenter .45 ycenter .7 | |
add shieldUp xcenter .50 ycenter .7 | |
add shieldUp xcenter .55 ycenter .7 | |
elif hit ==2: | |
add shieldBroken xcenter .45 ycenter .7 | |
add shieldBroken xcenter .50 ycenter .7 | |
add shieldUp xcenter .55 ycenter .7 | |
elif hit==3: | |
add shieldBroken xcenter .45 ycenter .7 | |
add shieldBroken xcenter .50 ycenter .7 | |
add shieldBroken xcenter .55 ycenter .7 | |
### This if statement causes the target to dissapear as the player took too long. Empty is a variable tied to a blank image in our init | |
## This removes a target from the screen either if it grows past its border and 'pops' or if the player has clicked it | |
##If this is triggered as a result of 'popping' a hit is recorded | |
if blow0.zoomed>=2.4 and blow0.parry!=empty or blow0.clear== True and blow0.parry!=empty: | |
if blow0.clear== False: | |
$hit+=1 | |
$blow0.parry=empty | |
$blow0.blocked=empty | |
$blow0.target=empty | |
$blow0.clear=True | |
#This checks if the player clicked the target while it was in a 'sweetspot' right before popping | |
#Currently there is no benefit to clicking on the sweetspot other than a different sound file in my case | |
elif 2.4>blow0.zoomed>=2.0 and not blow0.clear: | |
vbox xcenter blow0.X ycenter blow0.Y: | |
imagebutton idle blow0.parry hover blow0.parry action [Play ("sound", "parry.mp3"),SetField(blow0,"clear",True)] | |
add blow0.blocked xcenter blow0.X ycenter blow0.Y | |
add blow0.target xcenter blow0.X ycenter blow0.Y at number1(blow0.zoomed) | |
#This checks if the player clicked the target while it was valid | |
elif 2.0>blow0.zoomed>=1.6 and not blow0.clear: | |
vbox xcenter blow0.X ycenter blow0.Y: | |
imagebutton idle blow0.parry hover blow0.parry action [Play ("sound", "fistHit3.flac"),SetField(blow0,"clear",True), ] | |
add blow0.blocked xcenter blow0.X ycenter blow0.Y | |
add blow0.target xcenter blow0.X ycenter blow0.Y at number1(blow0.zoomed) | |
#This checks if the player clicked the target too early in which case it increases the hit counter by 1 | |
elif blow0.zoomed <1.6: | |
vbox xcenter blow0.X ycenter blow0.Y: | |
imagebutton idle blow0.parry hover blow0.parry action [Play ("sound", "whiff.flac"),SetField(blow0,"clear",True), SetVariable("hit",hit+1)] | |
add blow0.blocked xcenter blow0.X ycenter blow0.Y | |
add blow0.target xcenter blow0.X ycenter blow0.Y at number1(blow0.zoomed) | |
########################################################################################## | |
#Copy of above code for different target | |
if blow1.zoomed>=2.4 and blow1.parry!=empty or blow1.clear== True and blow1.parry!=empty: | |
if blow1.clear== False: | |
$hit+=1 | |
$blow1.parry=empty | |
$blow1.blocked=empty | |
$blow1.target=empty | |
$blow1.clear=True | |
elif 2.4>blow1.zoomed>=2.0 and not blow1.clear: | |
vbox xcenter blow1.X ycenter blow1.Y: | |
imagebutton idle blow1.parry hover blow1.parry action [Play ("sound", "parry.mp3"),SetField(blow1,"clear",True)] | |
add blow1.blocked xcenter blow1.X ycenter blow1.Y | |
add blow1.target xcenter blow1.X ycenter blow1.Y at number1(blow1.zoomed) | |
elif 2.0>blow1.zoomed>=1.6 and not blow1.clear: | |
vbox xcenter blow1.X ycenter blow1.Y: | |
imagebutton idle blow1.parry hover blow1.parry action [Play ("sound", "fistHit3.flac"),SetField(blow1,"clear",True)] | |
add blow1.blocked xcenter blow1.X ycenter blow1.Y | |
add blow1.target xcenter blow1.X ycenter blow1.Y at number1(blow1.zoomed) | |
elif blow1.zoomed <1.6 and not blow1.clear: | |
vbox xcenter blow1.X ycenter blow1.Y: | |
imagebutton idle blow1.parry hover blow1.parry action [Play ("sound", "whiff.flac"),SetField(blow1,"clear",True), SetVariable("hit",hit+1)] | |
add blow1.blocked xcenter blow1.X ycenter blow1.Y | |
add blow1.target xcenter blow1.X ycenter blow1.Y at number1(blow1.zoomed) | |
#################################### | |
#copy of above code for different target | |
if blow2.zoomed>=2.4 and blow2.parry!=empty or blow2.clear== True and blow2.parry!=empty: | |
if blow2.clear== False: | |
$hit+=1 | |
$blow2.parry=empty | |
$blow2.blocked=empty | |
$blow2.target=empty | |
$blow2.clear=True | |
elif 2.4>blow2.zoomed>=2.0 and not blow2.clear: | |
vbox xcenter blow2.X ycenter blow2.Y: | |
imagebutton idle blow2.parry hover blow2.parry action [Play ("sound", "parry.mp3"),SetField(blow2,"clear",True)] | |
add blow2.blocked xcenter blow2.X ycenter blow2.Y | |
add blow2.target xcenter blow2.X ycenter blow2.Y at number1(blow2.zoomed) | |
elif 2.0>blow2.zoomed>=1.6 and not blow2.clear: | |
vbox xcenter blow2.X ycenter blow2.Y: | |
imagebutton idle blow2.parry hover blow2.parry action [Play ("sound", "fistHit3.flac"),SetField(blow2,"clear",True)] | |
add blow2.blocked xcenter blow2.X ycenter blow2.Y | |
add blow2.target xcenter blow2.X ycenter blow2.Y at number1(blow2.zoomed) | |
elif blow2.zoomed <1.6 and not blow2.clear: | |
vbox xcenter blow2.X ycenter blow2.Y: | |
imagebutton idle blow2.parry hover blow2.parry action [Play ("sound", "whiff.flac"),SetField(blow2,"clear",True), SetVariable("hit",hit+1)] | |
add blow2.blocked xcenter blow2.X ycenter blow2.Y | |
add blow2.target xcenter blow2.X ycenter blow2.Y at number1(blow2.zoomed) | |
######################################## | |
#copy of above code for different target | |
if blow3.zoomed>=2.4 and blow3.parry!=empty or blow3.clear== True and blow3.parry!=empty: | |
if blow3.clear==False: | |
$hit+=1 | |
$blow3.parry=empty | |
$blow3.blocked=empty | |
$blow3.target=empty | |
$blow3.clear=True | |
elif 2.4>blow3.zoomed>=2.0 and not blow3.clear: | |
vbox xcenter blow3.X ycenter blow3.Y: | |
imagebutton idle blow3.parry hover blow3.parry action [Play ("sound", "parry.mp3"),SetField(blow3,"clear",True)] | |
add blow3.blocked xcenter blow3.X ycenter blow3.Y | |
add blow3.target xcenter blow3.X ycenter blow3.Y at number1(blow3.zoomed) | |
elif 2.0>blow3.zoomed>=1.6 and not blow3.clear: | |
vbox xcenter blow3.X ycenter blow3.Y: | |
imagebutton idle blow3.parry hover blow3.parry action [Play ("sound", "fistHit3.flac"),SetField(blow3,"clear",True)] | |
add blow3.blocked xcenter blow3.X ycenter blow3.Y | |
add blow3.target xcenter blow3.X ycenter blow3.Y at number1(blow3.zoomed) | |
elif blow3.zoomed <1.6 and not blow3.clear: | |
vbox xcenter blow3.X ycenter blow3.Y: | |
imagebutton idle blow3.parry hover blow3.parry action [Play ("sound", "whiff.flac"),SetField(blow3,"clear",True), SetVariable("hit",hit+1)] | |
add blow3.blocked xcenter blow3.X ycenter blow3.Y | |
add blow3.target xcenter blow3.X ycenter blow3.Y at number1(blow3.zoomed) | |
############################################# | |
#Calls functions that cause targets to grow then resets them after a random period of time. | |
$growth(blow0) | |
$growth(blow1) | |
$growth(blow2) | |
$growth(blow3) | |
#Resets the game loop | |
timer 0.01 action renpy.restart_interaction repeat True |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment