Home > other >  How cocos2d - js + websocket server issue instructions after operating the Sprite on the layer objec
How cocos2d - js + websocket server issue instructions after operating the Sprite on the layer objec

Time:09-25



As title, foreground program can be received by the websocket server information, such as the server returns a coordinates x, y
And then assume MainLayer has a spirit, called monster wants to write a function to change the elves, but why always prompt ". This monster is undefined undefined objects,
MainLayer. Js

Var aa;
Aa=function (x, y) {
Var action0=cc. Sequence. The create (cc) MoveTo) create (1 cc), p (x, y)));//
this. Monster. RunAction (action0);
};

And if there is a button on the MainLayer, write action ABC ()
MainLayer. Prototype. ABC=function () {
Cc. The log (" ac ");
Var action0=cc. Sequence. The create (cc) MoveTo) create (1 cc), p (11, 222)));//
This. The monster. RunAction (action0);
}
Point button action monster can move again, it is how to write aa () in the operation of the object?

CodePudding user response:

No one, himself a hat

CodePudding user response:

Their top up his top

CodePudding user response:

By the roof top
  • Related