LBXGame icon indicating copy to clipboard operation
LBXGame copied to clipboard

请问下初始化游戏的时候向量是怎么计算的?

Open Veepim opened this issue 6 years ago • 0 comments

你的demo是个六角形的消除游戏, 我的项目是正方形的消除游戏8*8格,初始化的时候位置怎么调整呢

` //要加的单位向量 var addVec = cc.pMult(cc.pForAngle(240 * (2 * Math.PI / 360)), this["liubianxingH"] * 2)

    //偏移至源点0,0的向量
    var pianyiTo0p0Vec = cc.pMult(cc.pForAngle(120 * (2 * Math.PI / 360)), this["liubianxingH"] * 2 * 4)


    var frameList = []

    var fPosList = []
        //一列列来生成
    for (var i = 0; i < posList.length; i++) {
        var count = posList[i].count //数量
        var oneSrcPos = cc.pAdd(posList[i].srcPos, pianyiTo0p0Vec) //起始位置
        var aimPos = cc.pAdd(srcPos, oneSrcPos) //一条的起始位置

        for (var j = 0; j < count; j++) {
            var fPos = cc.pAdd(aimPos, cc.pMult(addVec, j))
            fPosList.push(fPos)
        }
    }`

Veepim avatar May 23 '18 10:05 Veepim