示例#1
0
        public override void ccTouchesEnded(List <CCTouch> touches, CCEvent event_)
        {
            //base.ccTouchesEnded(touches, event_);
            object  it    = touches.First();
            CCTouch touch = (CCTouch)(it);

            CCPoint location          = touch.locationInView(touch.view());
            CCPoint convertedLocation = CCDirector.sharedDirector().convertToGL(location);

            CCNode s = getChildByTag(ClickAndMoveTest.kTagSprite);

            s.stopAllActions();
            s.runAction(CCMoveTo.actionWithDuration(1, new CCPoint(convertedLocation.x, convertedLocation.y)));
            float o  = convertedLocation.x - s.position.x;
            float a  = convertedLocation.y - s.position.y;
            float at = (float)(Math.Atan(o / a) * 57.29577951f);

            if (a < 0)
            {
                if (o < 0)
                {
                    at = 180 + Math.Abs(at);
                }
                else
                {
                    at = 180 - Math.Abs(at);
                }
            }

            s.runAction(CCRotateTo.actionWithDuration(1, at));
        }
示例#2
0
 public void bugMe(CCNode node)
 {
     node.stopAllActions(); //After this stop next action not working, if remove this stop everything is working
     node.runAction(CCScaleTo.actionWithDuration(2, 2));
 }