My friend makes a mini-game, based on the game Fable, and the result was such a terrible, but working prototype of fishing.
Here is the code of the fishing:
script.rpy
Code: Select all
label start:
scene Bg_Fable with dissolve
window hide
jump StartMiniGame
$ renpy.pause()
return
label StartMiniGame:
$ FishUp = renpy.random.randint(30,50) # Responsible for where the fish will start
show screen Fish_Up
call screen MiniGameFish
if _return == "EndMiniGame":
jump start
Fishing.rpy
Code: Select all
init 15:
$ Fish = 1 # Cheats for proper mini-game performance.
$ Broken = 0 # Responsible for the fish breaking
$ BrokenFish = 0 # Also responsible for the fish breaking
$ Random_Time = 1
init -5 python:
style.FishingBar = Style(style.default)
style.FishingBar.left_bar = Frame("MiniGameFishing/BarFull.png", 0, 0)
style.FishingBar.right_bar = Frame("MiniGameFishing/BarEmpty.png", 0, 0)
style.FishingBar.thumb = "MiniGameFishing/thumb.png"
style.FishingBar.thumb_offset = 26
style.FishingBar.left_gutter = 35
style.FishingBar.xmaximum = 364 # bar width
style.FishingBar.ymaximum = 50 # bar height
screen MiniGameFish:
add "MiniGameFishing/Bg.jpg"
if BrokenFish == 0:
add "MiniGameFishing/status1.jpg" align(0.5,0.6)# Images from the value of BrokenFish
if BrokenFish == 1: # Those we observe fishing line tensioned by these images
add "MiniGameFishing/status2.jpg" align(0.5,0.6)
if BrokenFish == 2:
add "MiniGameFishing/status3.jpg" align(0.5,0.6)
if BrokenFish == 3:
add "MiniGameFishing/status4.jpg" align(0.5,0.6)
if BrokenFish == 4:
add "MiniGameFishing/status5.jpg" align(0.5,0.6)
if FishUp <= 0:# The condition of the button that is responsible for catching fish.
key "K_SPACE" action Jump("YouWin")
else:
if BrokenFish <= 3:
if Broken == 1:
key "K_SPACE" action [SetVariable("FishUp", FishUp - 1), SetVariable("BrokenFish", BrokenFish + 1)]
if Broken == 0:
key "K_SPACE" action SetVariable("FishUp", FishUp - 1)
if BrokenFish == 4:
key "K_SPACE" action Jump("BrokenFish_End")
# This terms said. If FishUp is less than or equal to zero, then we win. (FishUp is responsible for filling the bar)
# Otherwise, if BrokenFish is less than or equal to three, the button will perform 2 actions, one of which is limiting the number of clicks when the fish breaks out.
# If Broken is 1, then we catch fish and at the same time it can be popped.
# If Broken is 0, then we just catch fish
# If BrokenFish is four, then the fish will break
bar:
style "FishingBar"
range 150
value FishUp
align(0.5,0.7)
screen Fish_Up:
timer 0.01 action SetVariable("Random_Time", renpy.random.randint(1,6))# Responsible for a pause, during which you can safely pull the fish
if BrokenFish> = 1:
timer 0.7 repeat True action SetVariable ("BrokenFish", BrokenFish - 1) # Responsible for the fact that the fishing line on the fishing rod will lose its tension, You can also change the time for dropping the tension
if BrokenFish == 0:
timer 0.05 repeat True action NullAction()
if FishUp <= 149:
timer Random_Time repeat True action SetVariable("Fish", renpy.random.randint(1,5)), Hide("Fish_Up"),Show("Fish_Free")# Here we have a random value variable Fish
if FishUp> = 150: # As a matter of fact just sets the time of resistance of the fish
timer 0.01 action Jump("YouLose")
screen Fish_Free:
if FishUp <= 149:
if Fish == 1:
if FishUp <= 149:
timer 0.03 repeat True action SetVariable("FishUp", FishUp + 1), SetVariable("Fish", Fish + 1), SetVariable("Broken", 1)
if FishUp >= 150:
timer 0.01 action Jump("YouLose")
if Fish == 2:
if FishUp <= 149:
timer 0.03 repeat True action SetVariable("FishUp", FishUp + 1), SetVariable("Fish", Fish + 1), SetVariable("Broken", 1)
if FishUp >= 150:
timer 0.01 action Jump("YouLose")
if Fish == 3:
if FishUp <= 149:
timer 0.03 repeat True action SetVariable("FishUp", FishUp + 1), SetVariable("Fish", Fish + 1), SetVariable("Broken", 1)
if FishUp >= 150:
timer 0.01 action Jump("YouLose")
if Fish == 4:
if FishUp <= 149:
timer 0.03 repeat True action SetVariable("FishUp", FishUp + 1), SetVariable("Fish", Fish + 1), SetVariable("Broken", 1)
if FishUp >= 150:
timer 0.01 action Jump("YouLose")
if Fish == 5:
if FishUp <= 149:
timer 0.03 repeat True action SetVariable("FishUp", FishUp + 1), SetVariable("Fish", Fish + 1), SetVariable("Broken", 1)
if FishUp >= 150:
timer 0.01 action Jump("YouLose")
if Fish == 6:
if FishUp <= 149:
timer 0.03 repeat True action SetVariable("FishUp", FishUp + 1), SetVariable("Fish", Fish + 1), SetVariable("Broken", 1)
if FishUp >= 150:
timer 0.01 action Jump("YouLose")
if Fish == 7:
if FishUp <= 149:
timer 0.03 repeat True action SetVariable("FishUp", FishUp + 1), SetVariable("Fish", Fish + 1), SetVariable("Broken", 1)
if FishUp >= 150:
timer 0.01 action Jump("YouLose")
if Fish == 8:
if FishUp <= 149:
timer 0.03 repeat True action SetVariable("FishUp", FishUp + 1), SetVariable("Fish", Fish + 1), SetVariable("Broken", 1)
if FishUp >= 150:
timer 0.01 action Jump("YouLose")
if Fish == 9:
if FishUp <= 149:
timer 0.03 repeat True action SetVariable("FishUp", FishUp + 1), SetVariable("Fish", Fish + 1), SetVariable("Broken", 1)
if FishUp >= 150:
timer 0.01 action Jump("YouLose")
if Fish == 10:
if FishUp <= 149:
timer 0.03 repeat True action SetVariable("FishUp", FishUp + 1), SetVariable("Fish", Fish + 1), SetVariable("Broken", 1)
if FishUp >= 150:
timer 0.01 action Jump("YouLose")
if Fish == 11:
if FishUp <= 149:
timer 0.03 repeat True action SetVariable("FishUp", FishUp + 1), SetVariable("Fish", Fish + 1), SetVariable("Broken", 1)
if FishUp >= 150:
timer 0.01 action Jump("YouLose")
if Fish == 12:
if FishUp <= 149:
timer 0.03 repeat True action SetVariable("FishUp", FishUp + 1), SetVariable("Fish", Fish + 1), SetVariable("Broken", 1)
if FishUp >= 150:
timer 0.01 action Jump("YouLose")
if Fish == 13:
if FishUp <= 149:
timer 0.03 repeat True action SetVariable("FishUp", FishUp + 1), SetVariable("Fish", Fish + 1), SetVariable("Broken", 1)
if FishUp >= 150:
timer 0.01 action Jump("YouLose")
if Fish == 14:
if FishUp <= 149:
timer 0.03 repeat True action SetVariable("FishUp", FishUp + 1), SetVariable("Fish", Fish + 1), SetVariable("Broken", 1)
if FishUp >= 150:
timer 0.01 action Jump("YouLose")
if Fish == 15:
if FishUp <= 149:
# This timer is always left last.
# If you want to break the time of resistance of the fish, just copy one of the conditions above and paste above this line
# But do not forget to change the value of Fish. The more time the fish resists, the more conditions there will be with Fish.
timer 0.03 repeat True action SetVariable("FishUp", FishUp + 1), SetVariable("Fish", Fish + 1), SetVariable("Broken", 0), Hide('Fish_Free'), Show('Fish_Up'), If(FishUp >= 150, Jump("YouLose"))
if FishUp >= 150:
timer 0.01 action Jump("YouLose")
if FishUp >= 150:
timer 0.01 action Jump("YouLose")
label YouLose:
window show
"YouLose"
window hide
return
label YouWin:
$ TypeFish = renpy.random.choice(["Salmon", "Carp", "Saiga", "Fish Hedgehog"])
window show
"[TypeFish]"
window hide
$ renpy.pause(5, hard=True)
return
label BrokenFish_End:
"The fish fell through"
window hide
return
Need help to bring this into a readable form, and if it is not difficult to improve it