http://lemmasoft.renai.us/forums/viewto ... =8&t=19171
Problem 1:
I want to Randomize the Choice of the Foe(PC), so I used this:
Code: Select all
$ foecard = renpy.random.choice(['Rock', 'Paper', 'Scissors'])
Problem 2:
ROCK vs SCISSOR= DRAW
The image below explains... Why is it like that?
I used what PyTom told me and followed through.. what's the matter?
Since the Foe's choice can't be randomized,
I defined the foe's choice by calling labels that looked like this:
Code: Select all
label foescissors:
$ foecard = ["Scissors"]
show Scissors as fchoice at pos5 with moveinright
return Player's choice was defined by an imagemap.
It linked to these:
Code: Select all
label Rock:
$ playercard = ["Rock"]
show Rock at pos3 with moveinleft
jump next
label Paper:
$ playercard = ["Paper"]
show Paper at pos1 with moveinleft
jump next
label Scissors:
$ playercard = ["Scissors"]
show Scissors at pos1 with moveinleft
jump next
whatever option you pick.
Code: Select all
label next:
"Compare!"
# Foe's Card defined here by call: foe+("rock",paper,scissors)
call foescissors
call check
if rps_win(playercard, foecard):
"Player wins, Foe lost."
elif rps_win(foecard, playercard):
"Foe Wins, You Lost."
else:
"Draw"
""
Code: Select all
label check:
init python:
# This contains the tuple (a, b) if a wins against b.
RPS_WINS = [ ("Rock", "Scissors")or ("Scissors", "Paper")or ("Paper", "Rock") ]
# Returs true if a beats be in Rock-paper-scissors.
def rps_win(playercard, foecard):
return (playercard, foecard) in RPS_WINS
return

