Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
Veepim opened this issue May 23, 2018 · 0 comments
Open

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

Veepim opened this issue May 23, 2018 · 0 comments

Comments

@Veepim
Copy link

Veepim commented May 23, 2018

你的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)
        }
    }`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant