「网易官方」极客战记(codecombat)攻略-游戏开发1-投火throwing-fire

「网易官方」极客战记(codecombat)攻略-游戏开发1-投火throwing-fire

简介

有些游戏对象可以设置属性。

"fire-spewer" 能喷射火球!

默认喷射方向是 "horizontal" (横向)。

你可以将属性改为 "vertical" ,让其纵向喷射,代码如下:

spew = game.spawnXY("fire-spewer", 40, 40)
spew.direction = "vertical"

默认代码

# 游戏对象可以设置属性。

 

# 不要改变这个,它是设置游戏的。
player = game.spawnPlayerXY("knight", 40, 10)
game.addCollectGoal()
game.addSurviveGoal()

 

game.spawnXY("gem", 32, 55)
game.spawnXY("gem", 51, 55)

 

fs1 = game.spawnXY("fire-spewer", 12, 25)
fs2 = game.spawnXY("fire-spewer", 70, 30)
fs3 = game.spawnXY("fire-spewer", 12, 35)
fs4 = game.spawnXY("fire-spewer", 70, 40)

 

# 将fs1.direction改成"vertical":
fs1.direction = "horizontal"   # ∆ Change this.

 

# 再将fs2.direction改成"vertical":

 

# fs3和fs4也这样做:

 

# 下面开始游戏并收集宝石!

概览

Coming soon!

投火 解法

# 游戏对象可以设置属性。
# 不要改变这个,它是设置游戏的。
player = game.spawnPlayerXY("knight", 40, 10)
game.addCollectGoal()
game.addSurviveGoal()
game.spawnXY("gem", 32, 55)
game.spawnXY("gem", 51, 55)
fs1 = game.spawnXY("fire-spewer", 12, 25)
fs2 = game.spawnXY("fire-spewer", 70, 30)
fs3 = game.spawnXY("fire-spewer", 12, 35)
fs4 = game.spawnXY("fire-spewer", 70, 40)
# 将fs1.direction改成"vertical":
fs1.direction = "vertical"
# 再将fs2.direction改成"vertical":
fs2.direction = "vertical"
# fs3和fs4也这样做:
fs3.direction = "vertical"
fs4.direction = "vertical"
# 下面开始游戏并收集宝石!
本攻略发于极客战记官方教学栏目,原文地址为: