用户:
6212377查看:0 回复:0 评论:0 创建时间:2022-10-18T20:23:38
【作品展示】

【作品介绍】
真。文字游戏。介绍里面有。纯文本。就NB好吧。这是第一代,后续不知什么时候会出第二代。
【作品源代码】
import random
import math
sj = random.randint(3, 6)
xl = 10
yyy = []
xxx = []
p = 0
jnj = 5
jnx = 0
jny = 0
c = 0
xx = random.randint((-50), 50)
yy = random.randint((-50), 50)
x = random.randint((-50), 50)
y = random.randint((-50), 50)
print('接下来开始游戏,请阅读说明:')
print('w s a d 分别对应上 下 左 右。及控制发方向。输入均为方向。每次行走一个单位。需要玩家控制点到达终点。')
print('本游戏为纯文字。')
print('技能:瞬移(输入 jn)但是不能直接传送到目的地否则……')
print('随机轰炸(轰炸前会提醒)')
def function1():
print('当前坐标:')
print(xx,yy)
print('__________________________')
if (xx == x and yy == y):
print('已到达终点')
p = 1
def hz():
global hy
global hx
global sj
if (sj == 2):
hy = random.randint((x - 2), (x + 2))
hx = random.randint((y - 2), (y + 2))
print('下一轮将开始轰炸!')
sj -= 1
elif (sj > 1):
sj -= 1
elif (sj == 1):
ld = ((hy - yy) * (hy - yy) + (hx - xx) * (hx - xx))
if (math.sqrt(abs(ld)) <= 10):
xl -= 3
sj = random.randint(3, 6)
else:
pass
while (p == 0):
function1()
print('血量', xl)
print('目标坐标')
print(x, y)
h = input('')
if (h == 'w'):
hz()
yy += 1
if (yy <= 50 and yy >= 0):
function1()
if (p == 1):
break
elif (yy > 50):
yy -= 1
print('超出边界!')
else:
pass
elif (h == 's'):
hz()
yy -= 1
if (yy >= -50 and yy <= 50):
function1()
if (p == 1):
break
else:
yy += 1
print('超出边界')
elif (h == 'a'):
hz()
xx -= 1
if (xx <= 50 and xx >= 0):
function1()
if (p == 1):
break
else:
xx += 1
print('超出边界!')
elif (h == 'd'):
hz()
xx += 1
if (xx <= 50 and xx >= 0):
function1()
if (p == 1):
break
else:
xx -= 1
print('超出边界!')
elif (h == 'jn'):
jnx = int(input('输入坐标(x)'))
jny = int(input('输入坐标(y)'))
if (jnx <= 50 and jnx >= -50 and jny <= 50 and jny >= -50):
if (jnx == x or jny == y):
print('接受惩罚')
for count in range(50):
xxxx = random.randint((-50), 50)
yyyy = random.randint((-50), 50)
f = ((xxxx - xx) + (yyyy - yy))
if (abs(f) > 18 and xxxx != x and yyyy != y):
xx = xxxx
yy = yyyy
else:
xx = jnx
yy = jny
else:
print('超出边界')
else:
print('输入错误!!!')
【提示】
部分含有Python第三方库相关内容的作品,在海龟编辑器网页端无法运行哦!如遇到这种情况,可以打开下面的链接,下载海龟编辑器客户端:
https://python.codemao.cn