python极客战记_极客战记(原名codecombat)安息之云山峰——激流回旋PYTHON代码...

# 使用对象枚举来走安全的路,并收集宝石。

# 在本关你不能够使用 moveXY()方法!使用 move()来移动

gems = hero.findItems()

while hero.pos.x < 20:

# move()移动物体通过 x 和 y 的属性,不仅仅是数字。

hero.move({'x': 20, 'y': 35})

while hero.pos.x < 25:

# 一个宝石的位置是一个对象,有 x 和 y 属性。

gem0 = gems[0]

hero.move(gem0.pos)

# 当你的 x 小于30的时候,

# 使用物体移动到30,35位置

while hero.pos.x < 30:

# move()移动物体通过 x 和 y 的属性,不仅仅是数字。

hero.move({'x': 30, 'y': 35})

# 当你的 x 小于35的时候

# 移动到宝石[1]的位置

while hero.pos.x < 35:

# 一个宝石的位置是一个对象,有 x 和 y 属性。

gem1 = gems[1]

hero.move(gem1.pos)

# 拿到最后一对宝石!

while hero.pos.x < 40:

# move()移动物体通过 x 和 y 的属性,不仅仅是数字。

hero.move({'x': 40, 'y': 35})

while hero.pos.x < 45:

# 一个宝石的位置是一个对象,有 x 和 y 属性。

gem2 = gems[2]

hero.move(gem2.pos)

while hero.pos.x < 50:

# move()移动物体通过 x 和 y 的属性,不仅仅是数字。

hero.move({'x': 50, 'y': 35})

while hero.pos.x < 55:

# 一个宝石的位置是一个对象,有 x 和 y 属性。

gem3 = gems[3]

hero.move(gem3.pos)

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值