Home > other >  Under Windows cocos2dx animation loading problem
Under Windows cocos2dx animation loading problem

Time:09-23

When debugging, error problem is as follows:
The first chance to abnormal 0 x003172cf (in MonkeyKing. Exe) : 0 xc0000005: while reading position 0 XCCCCCCCC access conflict,
0 x003172cf in untreated exception (the MonkeyKing. Exe) : 0 xc0000005: while reading position 0 XCCCCCCCC access conflict,


The code is as follows:
 
Bool HelloWorld: : init ()
{
//////////////////////////////
//1. Super init first
if ( ! Layer: : init ())
{
return false;
}
The Size visibleSize=Director: : getInstance () - & gt; GetVisibleSize ();

Auto player=Sprite: : create (" error. PNG ");
Player - & gt; SetPosition (visibleSize. Width/2, visibleSize height/2);
AddChild (player);



//load the cached
SpriteFrameCache * frameCache=SpriteFrameCache: : getInstance ();
FrameCache - & gt; AddSpriteFramesWithFile (" 123. Plist ", "123 PNG");

//memory using the container traversal of the animation,
The Vector & lt; SpriteFrame * & gt; Animation;
for(int i=1; i<9. I++)
{
Char name [256]={0};
Sprintf (name, "chuShou % d.p ng", I);
A=SpriteFrame * frameCache - & gt; SpriteFrameByName (name);
Animation. PushBack (a);

}

//the contents of the container is convenient to create objects
Animation * b=CCAnimation: : createWithSpriteFrames (Animation);
//0.1 seconds a frame
B - & gt; SetDelayPerUnit (0.1 f);
B - & gt; SetRestoreOriginalFrame (true);
//create animation
The Animate * act=CCAnimate: : create (b);
//create a functional action
Auto callFunc=callFunc: : create ([& amp;] () {player - & gt; RemoveFromParent ();
});

Auto sequence=sequence: : create (act, callFunc, NULL);

Player - & gt; RunAction (sequence);//run the elf object

return true;
}

Also began to can't find the problem, a great god, please help,
  • Related