首页
学习
活动
专区
工具
TVP
发布
社区首页 >问答首页 >缺少位置参数怎么解决?

缺少位置参数怎么解决?

提问于 2021-12-31 15:30:52
回答 1关注 0查看 143

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'

回答

和开发者交流更多问题细节吧,去 写回答
相关文章

相似问题

相关问答用户
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档