其他分享
首页 > 其他分享> > 【转载】网易极客战记官方攻略-游戏开发1-投火

【转载】网易极客战记官方攻略-游戏开发1-投火

作者:互联网

关卡连接:https://codecombat.163.com/play/level/throwing-fire

免费试玩:https://codecombat.163.com/play

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

简介

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

"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" # 下面开始游戏并收集宝石!  

本攻略发于极客战记官方教学栏目,原文地址为:

https://codecombat.163.com/news/jikezhanji-touhuo

极客战记——学编程,用玩的!  

标签:direction,极客,vertical,fire,spewer,game,投火,战记,spawnXY
来源: https://www.cnblogs.com/codecombat/p/12124033.html