在cocos2D-HTML5
我无法从 1 个类中创建 2 个实例。我使用引擎cocos2D HTML 5 版本。问题是我有一个移动平台,第一个创建的实例将移动。当我添加第二个平台时。第一个和第二个平台不会移动。
这是我创建新实例的代码:
addPlatform:function(parentObj)
{
window.setTimeout(function(){
var platform = new Player();
platform.init(null);
platform.setPlatformPosition(coords[0].x,coords[0].y);
platforms.push(platform);
parentObj.addChild(platforms[0]); },3000);
window.setTimeout(function(){
var platform2 = new Player();
platform2.init(null);
platforms.push(platform2);
platform2.setPlatformPosition(coords[1].x,coords[1].y);
parentObj.addChild(platforms[1]); },6000);
//console.log(platforms[1]);
},
要查看错误,请访问此网站
谢谢