我在第37行有一個問題,我嘗試在一行上輸入一串打印語句。一個告訴你一件事,一個帶有選擇聲明,另一個帶變量enemy11
。我怎樣才能在一行上打印所有內容?Python文本打鬥:在一行上打印
此外,隨機選擇,說它選擇拳打,我怎麼能檢測到,所以我可以把它從你的健康?所以它選擇了一拳。它承認它被打孔並從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!")
這是一個非常酷計劃! –
我有很多有趣的編程! – Narks