消除类,多对象for循环同时执行sequence,大量错乱!

一个爱消除游戏,开局通过for循环,掉落9×9一共81个块.
逻辑:
在for循环中计算出每个块的起始坐标,到达坐标,用node.runAction(cc.moveTo(…))方法,一切正常。
改进:
现在我想让块掉落到指定位置后,做一次缩放操作,显得活泼一些,所以在其他逻辑都不变的情况下,修改了一点点:
let scaleTime = 0.1;
let sacleSizeX = 0.7;
let sacleSizeY = 0.7;
let scaleSizeY1 = 0.8sacleSizeY;
let scaleSizeY2 = 1.2
sacleSizeY;
let action1 = cc.scaleTo(scaleTime, sacleSizeX,scaleSizeY1);
let action2 = cc.scaleTo(scaleTime, sacleSizeX,scaleSizeY2);
let action3 = cc.scaleTo(scaleTime, sacleSizeX,sacleSizeY);

    let dropAct = cc.sequence(cc.moveTo(moveTime,endPosition),action1, action2, action3);
    candySprite.runAction(dropAct);

问题:
在块数量12个以内(比如3×4),以上逻辑都正常,但是当父节点内超过15个(5×5)的时候,我尝试在update()函数中打印了for循环中的第一个块的Y轴坐标getPositionY(),发现屏幕上块走到了指定的位置,可是getPositionY()中的出来的该块的Y轴却远远大于要掉落的位置。这直接导致了在后面的逻辑中,块的坐标不准确,无法判断到这个块在哪。

问题提升:
同样的问题出现在删除块的时候,当3个或以上需要消除,直接销毁,是正常的,可是使用
candySpriteNode.runAction(cc.sequence(blinkAct,
cc.callFunc(function(){CSPool.put(candySpriteNode);},
this)));
同样使用的sequence,界面上补充掉落的块会随机消失(估计还是Y轴坐标的问题)

结论:
感觉是因为同时执行了多个sequence,后面执行的影响到了前面的对象?但实际情况还是不明白。不知道是否有好的解决办法?

1、游戏初始化时,第一次全部掉落,直接采用moveTo,update打印出的第一个块的Y坐标(由于X坐标不需要移动,我打印出来看过,x是正常的):
2016-12-07T07:58:33.679Z - normal: Simulator: ------------------------------------------------

2016-12-07T07:58:33.680Z - normal: Simulator: LOAD Js FILE: main.js

2016-12-07T07:58:33.681Z - normal: Simulator: ------------------------------------------------

2016-12-07T07:58:35.372Z - normal: Simulator: Cocos2d-JS v3.13

2016-12-07T07:58:35.764Z - normal: Simulator: iShow!

2016-12-07T07:58:36.415Z - normal: Simulator: 矩阵左下角点的坐标X:275 Y:375

2016-12-07T07:58:36.553Z - normal: Simulator: *块Y坐标:1335

2016-12-07T07:58:36.563Z - normal: Simulator: *块Y坐标:1335

2016-12-07T07:58:36.609Z - normal: Simulator: *块Y坐标:1268.724853515625

2016-12-07T07:58:36.613Z - normal: Simulator: *块Y坐标:1230.0660400390625

2016-12-07T07:58:36.614Z - normal: Simulator: *块Y坐标:1188.645751953125

2016-12-07T07:58:36.669Z - normal: Simulator: *块Y坐标:1147.2255859375

2016-12-07T07:58:36.671Z - normal: Simulator: *块Y坐标:1105.8052978515625

2016-12-07T07:58:36.677Z - normal: Simulator: *块Y坐标:1064.3851318359375

2016-12-07T07:58:36.694Z - normal: Simulator: *块Y坐标:1020.2034912109375

2016-12-07T07:58:36.696Z - normal: Simulator: *块Y坐标:973.2578125

2016-12-07T07:58:36.861Z - normal: Simulator: *块Y坐标:929.0762329101562

2016-12-07T07:58:36.868Z - normal: Simulator: *块Y坐标:694.3505859375

2016-12-07T07:58:36.870Z - normal: Simulator: *块Y坐标:636.3594970703125

2016-12-07T07:58:36.870Z - normal: Simulator: *块Y坐标:589.413818359375

2016-12-07T07:58:36.873Z - normal: Simulator: *块Y坐标:547.9935913085938

2016-12-07T07:58:36.880Z - normal: Simulator: *块Y坐标:512.0960693359375

2016-12-07T07:58:36.886Z - normal: Simulator: *块Y坐标:465.15313720703125

2016-12-07T07:58:36.898Z - normal: Simulator: *块Y坐标:420.9688720703125

2016-12-07T07:58:36.923Z - normal: Simulator: *块Y坐标:376.78729248046875

2016-12-07T07:58:36.925Z - normal: Simulator: *块Y坐标:375

2016-12-07T07:58:36.941Z - normal: Simulator: *块Y坐标:375

2016-12-07T07:58:36.982Z - normal: Simulator: *块Y坐标:375


2、当采用sequence来并行几十个块掉落并执行缩放的时候,他会掉落到固定位置,也会在到达目的地之后执行缩放,可是打印出来的getPositionY()值变成这样,走一小段就停了

2016-12-07T08:09:47.054Z - normal: Simulator: 矩阵左下角点的坐标X:275 Y:375

2016-12-07T08:09:47.090Z - normal: Simulator: *块Y坐标:1335

2016-12-07T08:09:47.108Z - normal: Simulator: *块Y坐标:1335

2016-12-07T08:09:47.112Z - normal: Simulator: *块Y坐标:1312.9091796875

2016-12-07T08:09:47.130Z - normal: Simulator: *块Y坐标:1282.534423828125

2016-12-07T08:09:47.148Z - normal: Simulator: *块Y坐标:1235.5887451171875

2016-12-07T08:09:47.170Z - normal: Simulator: *块Y坐标:1191.4071044921875

2016-12-07T08:09:47.180Z - normal: Simulator: *块Y坐标:1144.46142578125

2016-12-07T08:09:47.230Z - normal: Simulator: *块Y坐标:1097.5185546875

2016-12-07T08:09:47.231Z - normal: Simulator: *块Y坐标:1097.5185546875

2016-12-07T08:09:47.247Z - normal: Simulator: *块Y坐标:1097.5185546875

可以看到获取的Y轴坐标,并没有掉落到指定的矩阵要求的第一个位置,但实际上块已经掉落到那里了。


实在是调了2周,都没有办法解决这个问题,还请大家帮帮忙看看。
重点:
1、直接运行某一个动画(比如moveTo,NodePool.put()),游戏不会有任何问题,采用sequence运行一系列动画,会出现各种问题。
2、块的数量少,不容易出问题,块越多,问题越明显。

到底是sequence不能这么用,不能同时大量对象并发,会互相影响,还是怎么回事?!!!

尝试使用node.y能获取正确位置吗?

不行,我刚刚打印了一次,还是错的。而且每次启动,能掉落到的位置是随机的。。。

2016-12-07T08:49:17.234Z - normal: Simulator: 矩阵左下角点的坐标X:275 Y:375

2016-12-07T08:49:17.303Z - normal: Simulator: *块Y坐标:1335

2016-12-07T08:49:17.313Z - normal: Simulator: *块Y坐标:1335

2016-12-07T08:49:17.659Z - normal: Simulator: *块Y坐标:1301.86376953125

2016-12-07T08:49:17.676Z - normal: Simulator: *块Y坐标:1257.6822509765625

2016-12-07T08:49:17.677Z - normal: Simulator: *块Y坐标:1211.6597900390625

2016-12-07T08:49:17.700Z - normal: Simulator: *块Y坐标:1184.0462646484375

2016-12-07T08:49:17.717Z - normal: Simulator: *块Y坐标:1137.1033935546875

2016-12-07T08:49:17.727Z - normal: Simulator: *块Y坐标:1090.15771484375

2016-12-07T08:49:17.748Z - normal: Simulator: *块Y坐标:1045.97607421875

2016-12-07T08:49:17.780Z - normal: Simulator: *块Y坐标:999.0303955078125

2016-12-07T08:49:17.813Z - normal: Simulator: *块Y坐标:999.0303955078125

其实可以在sequence全部执行完以后,最后一个callFunc(…)重新setPosition,后面逻辑就正确,但很明显这是不符合逻辑的。因为后面还会有很多地方需要用到sequence…

可以写个demo上传下给大家看看。

而且,如果我是用sequence,里面塞一个moveTo(),再塞一个空的callFunc(),坐标也是错的。只要使用了sequence,不管里面放神恶魔,被moveTo的那个对象的值就会被改变掉。我实在是无语了。。。

我也遇到过此类问题,而且印象中是从1.2.2升到1.3后才出现的,导致一个对象moveTo不到指定的位置。
真是无语。

我尝试按楼上说的重新写个demo,结果发现重新创建的项目,用原来的资源和js,不会产生上面的问题。然后再运行老项目,居然自己好了,可是老项目运行几次以后,再次出现上面问题,而且不再恢复了。
并且最近写完js保存后(用的creator自己的编辑器),经常报这个错误:Load worker timeout, reload worker.而且连着十几次都无法完成编译。
creator 版本是刚更新的1.3.2 .
看来是新版编译器问题多多了。

动作执行完后,增加个刷新位置的功能。数组数据,精灵数据,这两套一起修改正。试试

新建的项目用同样的代码不会有问题,老项目会有。我估计可能是项目文件被损坏了?
试着删除了项目中的temp文件夹,让编译器重新生成,可是问题依旧。
而把新项目中的js copy到老项目中,再拖动到节点上,居然报错文件找不到。看来这个项目整体出问题了。