特技关卡 -
for b in bananas
until tiger.sleeping() and bear.sleeping()
wait()
goto b
//封装为函数
waitFor=()->
until tiger.sleeping() and bear.sleeping()
wait()
for b in bananas
waitFor()
goto b
CodeMonkey过关学习笔记系列:特技关卡 11-1 ~ 11-16 关
特技关卡 -
for b in bananas
until tiger.sleeping() and bear.sleeping()
wait() #在这里增加编码
if b.frozen()
goat.goto b
goat.hit()
until tiger.sleeping() and bear.sleeping()
wait()
goto b
//封装为函数
waitFor=()->
until tiger.sleeping() and bear.sleeping()
wait()
for b in bananas
waitFor() #在这里增加编码
if b.frozen()
goat.goto b
goat.hit()
waitFor()
goto b
CodeMonkey过关学习笔记系列:特技关卡 11-1 ~ 11-16 关
特技关卡 -
x =
times ->
until bears[x].sleeping() and tigers[x].sleeping()
wait()
goto bananas[x]
x = x +
//========================================================================================
waitFor=(obj1, obj2) ->
until obj1.sleeping() and obj2.sleeping()
wait()
x =
times ->
waitFOr(bears[x], tigers[x])
goto bananas[x]
x = x +
CodeMonkey过关学习笔记系列:特技关卡 11-1 ~ 11-16 关
特技关卡 -
until tiger.sleeping() and bear.sleeping()
wait()
for b in bananas
goto b
CodeMonkey过关学习笔记系列:特技关卡 11-1 ~ 11-16 关
特技关卡 -
for b in bananas
until bear.sleeping() or bear.playing()
wait()
if b.green()
goat.goto b
else
monkey.goto b
CodeMonkey过关学习笔记系列:特技关卡 11-1 ~ 11-16 关
特技关卡 -
for b in bananas
if b.green()
until tiger.sleeping() or tiger.playing()
wait()
goat.goto b
else
until bear.sleeping() or bear.playing()
wait()
goto b
//--------------------------------------------------------------------------------
waitFor = (obj) ->
until obj.sleeping() or obj.playing()
wait()
for b in bananas
if b.green()
waitFor(tigger)
goat.goto b
else
waitFor(bear)
goto b
CodeMonkey过关学习笔记系列:特技关卡 11-1 ~ 11-16 关
特技关卡 -
x =
times ->
until bears[x].sleeping() or bears[x].playing()
wait()
#我们最好等待熊睡觉或是玩耍
goto bananas[x]
x = x -
//----------------------------------------------------------------------------
waitFor = (obj) ->
until obj.sleeping() or obj.playing()
wait()
x =
times ->
waitFor(bears[x])
goto bananas[x]
x = x -
CodeMonkey过关学习笔记系列:特技关卡 11-1 ~ 11-16 关
特技关卡 -
until tiger.sleeping() or tiger.playing()
wait()
goat.goto bridges[]
until tiger.sleeping() or tiger.playing()
wait()
monkey.goto bridges[]
for b in bananas
if b.frozen()
goat.goto(b)
goat.hit()
monkey.goto b
CodeMonkey过关学习笔记系列:特技关卡 11-1 ~ 11-16 关
特技关卡 -
for b in bananas
if b.green() or b.frozen()
if b.frozen()
goat.goto b
goat.hit()
goat.goto b
goto bananas[]
CodeMonkey过关学习笔记系列:特技关卡 11-1 ~ 11-16 关
特技关卡 -
for b in bananas
if b.green() or b.frozen()
if b.frozen()
goat.goto b
goat.hit()
goat.goto b
times ->
step
turn left
CodeMonkey过关学习笔记系列:特技关卡 11-1 ~ 11-16 关
特技关卡 -
chaser = bear
times ->
say chaser
until chaser.sleeping() or chaser.playing()
wait()
step
chaser= tiger
CodeMonkey过关学习笔记系列:特技关卡 11-1 ~ 11-16 关
特技关卡 -
chaser = tiger
mover = monkey
for b in bananas
if b.green()
#完成我:
chaser = bear
mover = goat
else
#和我:
chaser = tiger
mover = monkey
until chaser.sleeping() or chaser.playing()
wait()
mover.goto b
CodeMonkey过关学习笔记系列:特技关卡 11-1 ~ 11-16 关
特技关卡 -
x =
times ->
for stepper in [monkey,goat]
until tigers[x].sleeping() and bears[x].sleeping()
wait()
stepper.step
x = x +
CodeMonkey过关学习笔记系列:特技关卡 11-1 ~ 11-16 关
特技关卡 -
waitFor = (b) ->
until b.sleeping() or b.playing()
wait()
x =
times ->
waitFor(bears[x])
goto bananas[x]
waitFor(bears[x])
goto turtle
turtle.step
x = x +
CodeMonkey过关学习笔记系列:特技关卡 11-1 ~ 11-16 关
特技关卡 -
until (tiger.playing() or tiger.sleeping()) and (bear.playing() or bear.sleeping())
wait()
goto banana
CodeMonkey过关学习笔记系列:特技关卡 11-1 ~ 11-16 关
特技关卡 -
for b in bananas
until ( bear.playing() or bear.sleeping() ) and ( tiger.playing() or tiger.sleeping() )
wait()
goto b