def map_2(marks,q,c):
print('Welcome to the mountain map.Now you have a chance to hit the circle.The mountain and pillar is barries,and circle is the target.')
print('v0=20m/s,you should input proper theta to hit the circle.')
print('欢迎来到高山地图,现在你有一次机会来击中目标。高山上的支柱为障碍,圆为目标')
print('初速度为20米每秒,你得调整射箭角度来击中目标')
time.sleep(3) # 时间停止3秒给玩家看规则
x,y,p_x,p_y,h,s,C_x,C_y,distance_x,distance_y,distance_z,distance_p,s,h=get_mountain_pillar_circle() # 调用get_mountain_pillar_circle()函数
plt.savefig('map_2.png')
n = 0
while n <= 3:
v0 = 20 # 初速度v0=20
n += 1
if n == 4:
c=0
plt.close(2) # 关闭图二
break
print('Try',n )
theta = float(input('请输入角度theta = '))*pi/180 # 玩家输入theta值
x,y = update(v0,theta) # x,y来自于update(v0,theta)
if n == 1:
plt.plot(x,y,color='red',label='Try 1')
plt.savefig('map_2 (%s).png'%(n)) # 保存此时画的图像,名称为map_2(s),格式 为png
elif n == 2:
plt.plot(x,y,color='blue',label='Try 2')
plt.savefig('map_2 (%s).png'%(n)) # 保存此时画的图像,名称为map_2(s),格式 为png
elif n == 3:
plt.plot(x,y,color='yellow',label='Try 3')
plt.savefig('map_2 (%s).png'%(n)) # 保存此时画的图像,名称为map_2(s),格式 为png
plt.legend(loc='upper right')
plot_trajectory(x,y) # 调用函plot_trajectory(x,y)数画出抛物线图象
test=hit(v0,theta,distance_x,distance_y,distance_z,distance_p,s,h) # test来源于hit(v0,theta)函数,用于判断是否击中目标,如果击中目标test=1,进行if test==1条件;如果test=0,进行if test==0条件
if test==0 :
marks -= 1
print('hp = ',marks)
if marks < 0:
c=0
plt.close(2) # 关闭图二
break
continue
if test == 1:
marks += 1
q +=1
print('hp = ',marks)
print('mark=',q)
print('Changing the map.【地图改变】')
plt.close(2) # 关闭图二
break
return marks,q,c
TypeError: map_2() missing 1 required positional argument: 'c'
相似问题