Discuss how to use the Ren'Py engine to create visual novels and story-based games. New releases are announced in this section.
Forum rules
This is the right place for Ren'Py help. Please ask one question per thread, use a descriptive subject like 'NotFound error in option.rpy' , and include all the relevant information - especially any relevant code and traceback messages. Use the code tag to format scripts.
label rps:
menu:
"Rock!":
$ rps_player = "rock"
"Paper!":
$ rps_player = "paper"
"Scissors!":
$ rps_player = "scissors"
$ rps_npc = renpy.random.choice(["rock", "paper", "scissors"])
e "I choose %(rps_npc)s!"
if (rps_player, rps_npc) in rps_beats:
e "You beat me!"
elif (rps_npc, rps_player) in rps_beats:
e "I win!"
else:
e "It's a tie! Let's do it again!"
jump rps
# ...
Last edited by ishify on Sat Jan 17, 2015 3:54 pm, edited 1 time in total.
Actually, it's probably more stylistic to name a constant like this RPS_BEATS - the all-uppercase lets us know it's a constant that we should never change, and never expect to change. This doesn't change the behavior at all, but it lets people reading your code - including yourself in a few days, months, or years - know more about the variable.
Supporting creators since 2004 (When was the last time you backed up your game?)