我在第 37 行遇到问题,我尝试在一行上键入一堆打印语句。一个告诉你一些事情,一个带有选择语句,另一个带有变量enemy11
。我怎么能在一行上打印所有这些?
另外,对于随机选择,比如说它选择打孔,我怎么能检测到它,这样我就可以把它从你的健康中带走?所以它选择了punch。它识别出它被打了,并从你的 HP 中拿走了拳。
hp=100
enemy1=100
enemy2=200
boss=500
punch=10
kick=20
fatality=99999999
attacks = ['kick', 'punch', 'fatality']
from random import choice
from time import sleep
print("Welcome to Ultimate Fight Club Plus")
sleep(1)
print("What is your name?")
name=raw_input("> ")
print("Good luck"), name
sleep(1)
print("Choose your opponent")
enemy11=raw_input("> ")
print("You chose"), enemy11
sleep(1)
print("his health is"), enemy1
sleep(1)
print("Fight!")
while enemy1>1:
print("You can kick or punch")
fight1=raw_input("> ")
if fight1=="punch":
enemy1 -= punch
print("You punch him in the face")
sleep(1)
print("His health is now"), enemy1
sleep(1)
print(enemy11) print choice(attacks) print("You")
if fight1=="kick":
enemy1 -= kick
print("You kick him.")
sleep(1)
print("His health is now"), enemy1
print("You win!")