creating 2 class instances doesn't work in cocos2D Javascript -
in cocos2d-html5
can't create 2 instances 1 class. use engine cocos2d html 5 version. issues have moving platform first created instance move. when add second platform. first , second platform won't move.
this code create new instances:
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]); },
to see bug please visit this website
thank you
Comments
Post a Comment