==============
#### REVISED CODE NOW WORKING WITH RENPY 6.9 and further ####
V 0.1.1 Tested against renpy 6.99.14.3
This is a Simon minigame.
The game show you a sequence that grow larger each step.
It's up to you to repeat the whole sequence by clicking buttons.
You lose if you press the wrong button or time expire.
You win by completing the whole sequence (10 signs in the sequence by default).
How to use it
Past simon code where you want. Then use in your game script:
Code: Select all
call simon pass (complete=10, toadd=2)
'Complete' MUST BE a multiple of 'toadd'.
The game require 5 images to work, and 4 sound effects. I'll give you some graphical proxy just below, but I don't own any proper sound.
In game, the sound effects are called (silly) bip, bop, bep, bup .ogg.
Code: Select all
### SIMON MINIGAME II 0.1.1
# Made by: GAS
# Found on LemmaSoft Forum
# Free to use at will
label simon(complete=10, toadd=2):
$ sequence=[]
$ yourguess=0
label simonturn:
# add signs to the sequence, enlarging it each turn.
$ seqiter=0
python:
for i in range(toadd):
roll=renpy.random.randint(0,3)
sequence.append(roll)
label simonshow:
$ i=0
while i<len(sequence):
$ thesign=sequence[i]
# display the actual sequence, sign by sign
# .. neutral screen (all greyed out)
show screen simonvoid
$ renpy.pause(0.5, hard=True)
hide screen simonvoid
# ... a button is lighted on!
show screen simondisplay
# ... so, play the relative sound
if thesign==0:
play sound "bip.ogg"
if thesign==1:
play sound "bop.ogg"
if thesign==2:
play sound "bep.ogg"
if thesign==3:
play sound "bup.ogg"
$ renpy.pause(0.5, hard=True)
hide screen simondisplay
$ i+=1
$ i=0 # Yeah, the very cornerstone of the game is that line!!
label simonguess:
$ thesign=sequence[i]
call screen simoncheck
$ dasign=_return
if dasign=="bust":
"Too slow!"
return
elif dasign!=thesign:
"Oh no! You missed it!"
return
if dasign==thesign:
$ i+=1
if i==len(sequence):
jump simonend
jump simonguess
label simonend:
if len(sequence)==complete:
"You won!"
return
jump simonturn
screen simondisplay():
text "SIMON SAYS..." xalign 0.5 yalign 0.2
grid 2 2:
xalign 0.5
yalign 0.5
spacing 5
if thesign==0:
add "red.png"
else:
add "grey.png"
if thesign==1:
add "green.png"
else:
add "grey.png"
if thesign==2:
add "blue.png"
else:
add "grey.png"
if thesign==3:
add "yellow.png"
else:
add "grey.png"
screen simonvoid():
text "SIMON SAYS..." xalign 0.5 yalign 0.2
grid 2 2:
xalign 0.5
yalign 0.5
spacing 5
for i in range(4):
add "grey.png"
screen simoncheck():
timer 3.0 action Return("bust")
bar value AnimatedValue(value=0, range=3, old_value=3, delay=3.0) xalign 0.5 xsize 500
text "!! REPEAT !!" xalign 0.5 yalign 0.2
grid 2 2:
xalign 0.5
yalign 0.5
spacing 5
imagebutton idle "grey.png" hover "red.png" action Return(0) activate_sound "bip.ogg"
imagebutton idle "grey.png" hover "green.png" action Return(1) activate_sound "bop.ogg"
imagebutton idle "grey.png" hover "blue.png" action Return(2) activate_sound "bep.ogg"
imagebutton idle "grey.png" hover "yellow.png" action Return(3) activate_sound "bup.ogg"