我将对象池建在碰撞的其中一方,这一方碰撞体叫做1,另一个碰撞体叫做2,对象池建在碰撞体1上,碰撞体2来至于对象池(在碰撞体1那建的)
当碰撞体1和碰撞体2相撞时,对象池将碰撞体2回收回对象池,这时产生这个错误。
我把对象池放到Canvas下,当产生碰撞时还是会出,removeFromParent is not a function:
removeFromParent is not a function 下面错误详细信息
Simulator: E/jswrapper (271): ERROR: Uncaught TypeError: obj.removeFromParent is not a function, location: src/cocos2d-jsb.js:0:0
STACK:
[0]put@src/cocos2d-jsb.js:51177
[1]removeShipin@assets/Script/StartPy.js:96
[2]onCollisionEnter@assets/Script/shipin.js:106
[3]_doCollide@src/cocos2d-jsb.js:11517
[4]update@src/cocos2d-jsb.js:11488
[5]update@src/cocos2d-jsb.js:9384
[6]mainLoop@src/cocos2d-jsb.js:7243
[7]callback@src/cocos2d-jsb.js:7476
[8]tick@jsb-adapter/jsb-builtin.js:2001
E/jswrapper (534): [ERROR] (…\cocos\scripting\js-bindings\jswrapper\v8\Object.cpp, 534): Invoking function (080D5AD0) failed!
at HTMLElement.print-simulator-log (E:\cocosecreator\CocosCreator\resources\app.asar\editor\builtin\scene\panel\messages\scene.js:1:1501)
at Object.e._dispatch (E:\cocosecreator\CocosCreator\resources\app.asar\editor-framework\lib\renderer\panel.js:1:1941)
at EventEmitter.o.on.s (E:\cocosecreator\CocosCreator\resources\app.asar\editor-framework\lib\renderer\ipc.js:1:2917)
at emitMany (events.js:127:13)
at EventEmitter.emit (events.js:204:7)