I have made a text-based RPG that uses dice rolling for the combat system. If you get a 1
, your attack is forfeited. You can keep rolling until you get a one, or type 'attack'
. I made a dice roller, and I just want to know, how to make it detect if the roll is 2
through 6
. Here is the code:
print ("Type roll to roll the dice")
rollKeeper = ("1")
while rollKeeper == ("1"):
rollOn = input ( )
if rollOn == ("roll"):
import random
def rollDice():
damage = random.randint(1,6)
damage = random.randint (1,6)
print (damage)
So I want to get it do detect numbers 2
through 6
, and that's it. I know about
if damage == ("1"):
but that is already part of my game. I just need to be able to detect if it is any of the others (up to 6
).
Roll it into a function, since it's reusable.
then just test.