当前位置:
首页
文章
移动端
详情

浮岛    构建循环  你自己的关卡

let greenPortal = Portal(color: #colorLiteral(red: 0.4028071761, green: 0.7315050364, blue: 0.2071235478, alpha: 1))


world.place (greenPortal, atStartColumn:

               

                1,

           

            startRow: 7,atEndColumn: 1, endRow: 1)

let A = Portal(color: #colorLiteral(red: 0.8043354153633118, green: 0.018336141481995583, blue: 6.016343689907444e-08, alpha: 1.0))


world.place (A, atStartColumn:

               

                2,

           

            startRow: 2,atEndColumn: 5, endRow: 4)

greenPortal.isActive = true

A.isActive = true

let expert = Character()

world.place(expert, facing: .north, atColumn: 1, row: 6)

let block9: Block = Block()

world.place(block9,

            atColumn: 1, row: 6)


let block8: Block = Block()

world.place(block8,

            atColumn: 5, row: 4)

let block7: Block = Block()

world.place(block7,

            atColumn: 6, row: 3)

let block6: Block = Block()

world.place(block6,

            atColumn: 2, row: 2)

let block5: Block = Block()

world.place(block5,

            atColumn: 1, row: 1)

for i in 1 ... 2 {

    let qc = Stair()

    world.place (qc,facing: .north, atColumn:2,row: 6)

    let qa = Stair()

    world.place (qa,facing: .north, atColumn:1,row: 6)

    let qb = Stair()

    world.place (qb,facing: .north, atColumn:1,row: 7)

}

func QQ() {

    if expert.isOnClosedSwitch {

        expert.toggleSwitch()

       

    } else if expert.isOnGem {

        expert.collectGem()

    }

}


for i in 1 ... 3 {

   

    for i in 1 ... 3 {

       

        for i in 1 ... 3 {

            if !expert.isBlocked {

                expert.moveForward()

            } else if  !expert.isBlockedRight {

                expert.turnRight()

               

            } else if !expert.isBlockedLeft {

                expert.turnLeft()

               

            }else if expert.isBlocked {

                expert.turnLeft()

                expert.turnLeft()

            }

           

            QQ()

           

        }

}

   

   

   

}

免责申明:本站发布的内容(图片、视频和文字)以转载和分享为主,文章观点不代表本站立场,如涉及侵权请联系站长邮箱:xbc-online@qq.com进行反馈,一经查实,将立刻删除涉嫌侵权内容。