예제 #1
0
        private void performanceActions20(CCSprite pSprite)
        {
            Random random = new Random();
            CCSize size   = CCDirector.sharedDirector().getWinSize();

            if (random.Next() < 0.2f)
            {
                pSprite.position = new CCPoint((random.Next() % (int)size.width), (random.Next() % (int)size.height));
            }
            else
            {
                pSprite.position = new CCPoint(-1000, -1000);
            }

            float            period            = 0.5f + (random.Next() % 1000) / 500.0f;
            CCRotateBy       rot               = CCRotateBy.actionWithDuration(period, 360.0f * random.Next());
            CCActionInterval rot_back          = null;
            CCAction         permanentRotation = CCRepeatForever.actionWithAction((CCActionInterval)CCSequence.actions(rot, rot_back));

            pSprite.runAction(permanentRotation);

            float            growDuration       = 0.5f + (random.Next() % 1000) / 500.0f;
            CCActionInterval grow               = CCScaleBy.actionWithDuration(growDuration, 0.5f, 0.5f);
            CCAction         permanentScaleLoop = CCRepeatForever.actionWithAction(CCSequence.actionOneTwo(grow, grow.reverse()));

            pSprite.runAction(permanentScaleLoop);
        }
예제 #2
0
        public void Hide()
        {
            //指定移动到最左边并超出屏幕
            CCMoveTo move = CCMoveTo.actionWithDuration(0.5f, new CCPoint(-CCDirector.sharedDirector().getWinSize().width, 0));

            //执行一个队列行为,当移动完成后就会调用HideAniCompled
            this.runAction(CCSequence.actionOneTwo(move, CCCallFunc.actionWithTarget(this, HideAniCompled)));
        }