I want to make it so that the user can eventually choose what attack they want to perform but for now, I'm trying to sort out 'attack'. I'm relatively new so any advice would be greatly appreciated. Thanks.
import random
print("Welcome to my game!")
def attack():
attack = random.randint(10,20)
magic = random.randint(5,30)
run = 999
user_choice = input("enter what you will do!: ")
print('''A T T A C K :
M A G I C :
R U N :
''')
def goblin_attack():
gob_attack = random.randint(5,10)
spaces = 50
def goblin():
dead = False
enemy_health = 20
user_health = 100
print("I am a goblin and I have come to slay you!")
attack()
while dead == False:
if user_choice == 'attack':
enemy_health = enemy_health - attack
goblin_attack()
user_health = user_health - gob_attack
damage_dealt = random.randint(5,30)
if enemy_health <= 0:
print("aghhhhhhh")
print("You defeated the goblin. Good job!")
dead = True
break
def dice_roll():
while True:
dice = input("press enter on your keyboard to roll the dice!: ")
rolled_dice = random.randint(1,6)
print("you rolled:",rolled_dice,"spaces")
spaces_moved = 0
spaces_moved = spaces_moved + rolled_dice
monster_gen = random.randint(1,3)
if monster_gen == 1:
goblin()
dice_roll()