public override void onEnter() { base.onEnter(); alignSpritesLeft(2); // Test: // Sequence should work both with IntervalAction and InstantActions CCActionInterval move1 = CCMoveBy.actionWithDuration(1, new CCPoint(250, 0)); CCActionInterval move2 = CCMoveBy.actionWithDuration(1, new CCPoint(0, 50)); CCToggleVisibility tog1 = new CCToggleVisibility(); CCToggleVisibility tog2 = new CCToggleVisibility(); CCFiniteTimeAction seq = CCSequence.actions(move1, tog1, move2, tog2, move1.reverse()); CCActionInterval action = CCRepeat.actionWithAction((CCActionInterval)(CCSequence.actions(seq, seq.reverse())), 3); // Test: // Also test that the reverse of Hide is Show, and vice-versa m_kathia.runAction(action); CCActionInterval move_tamara = CCMoveBy.actionWithDuration(1, new CCPoint(100, 0)); CCActionInterval move_tamara2 = CCMoveBy.actionWithDuration(1, new CCPoint(50, 0)); CCActionInstant hide = new CCHide(); CCFiniteTimeAction seq_tamara = CCSequence.actions(move_tamara, hide, move_tamara2); CCFiniteTimeAction seq_back = seq_tamara.reverse(); m_tamara.runAction(CCSequence.actions(seq_tamara, seq_back)); }
/// <summary> /// 加载图片 /// </summary> private void LoadPicture() { String picpath = String.Empty; if (IsTruePeople) { picpath = TruePicturePath; } else { picpath = FailPicturePath; } Picture = Media.PictureManager.GetCCTexture2DWithFile(picpath); List <CCSpriteFrame> frames = new List <CCSpriteFrame>(); for (int i = 0; i < FrameNumber; i++) { CCSpriteFrame frame = CCSpriteFrame.frameWithTexture(Picture, new CCRect(i * PicWidth, 0, PicWidth, PicHeight)); frames.Add(frame); } CCAnimation ani = CCAnimation.animationWithFrames(frames); this.initWithSpriteFrame(frames[0]); CCAnimate anima = CCAnimate.actionWithDuration(1f, ani, true); action = CCRepeat.actionWithAction(anima.reverse(), 3); }
public override void onEnter() { base.onEnter(); centerSprites(2); CCActionInterval act1 = CCRotateTo.actionWithDuration(1, 90); CCActionInterval act2 = CCRotateTo.actionWithDuration(1, 0); CCActionInterval seq = (CCActionInterval)(CCSequence.actions(act1, act2)); CCAction rep1 = CCRepeatForever.actionWithAction(seq); CCActionInterval rep2 = CCRepeat.actionWithAction((CCFiniteTimeAction)(seq.copy()), 10); m_tamara.runAction(rep1); m_kathia.runAction(rep2); }
public override void onEnter() { base.onEnter(); centerSprites(2); CCFiniteTimeAction seq = CCSequence.actions( CCRotateTo.actionWithDuration(0.5f, -20), CCRotateTo.actionWithDuration(0.5f, 20)); CCActionInterval rep1 = CCRepeat.actionWithAction(seq, 10); CCAction rep2 = CCRepeatForever.actionWithAction((CCActionInterval)(seq.copy())); m_tamara.runAction(rep1); m_kathia.runAction(rep2); }
public override void onEnter() { base.onEnter(); alignSpritesLeft(2); CCActionInterval a1 = CCMoveBy.actionWithDuration(1, new CCPoint(150, 0)); CCActionInterval action1 = CCRepeat.actionWithAction( CCSequence.actions(CCPlace.actionWithPosition(new CCPoint(60, 60)), a1), 3); CCAction action2 = CCRepeatForever.actionWithAction( (CCActionInterval)(CCSequence.actions((CCActionInterval)(a1.copy()), a1.reverse())) ); m_kathia.runAction(action1); m_tamara.runAction(action2); }
public override void onEnter() { base.onEnter(); float x, y; CCSize size = CCDirector.sharedDirector().getWinSize(); x = size.width; y = size.height; CCSprite sprite = CCSprite.spriteWithFile(s_pPathGrossini); CCSprite spriteSister1 = CCSprite.spriteWithFile(s_pPathSister1); CCSprite spriteSister2 = CCSprite.spriteWithFile(s_pPathSister2); sprite.scale = (1.5f); spriteSister1.scale = (1.5f); spriteSister2.scale = (1.5f); sprite.position = (new CCPoint(x / 2, y / 2)); spriteSister1.position = (new CCPoint(40, y / 2)); spriteSister2.position = (new CCPoint(x - 40, y / 2)); CCAction rot = CCRotateBy.actionWithDuration(16, -3600); addChild(sprite); addChild(spriteSister1); addChild(spriteSister2); sprite.runAction(rot); CCActionInterval jump1 = CCJumpBy.actionWithDuration(4, new CCPoint(-400, 0), 100, 4); CCActionInterval jump2 = (CCActionInterval)jump1.reverse(); CCActionInterval rot1 = CCRotateBy.actionWithDuration(4, 360 * 2); CCActionInterval rot2 = (CCActionInterval)rot1.reverse(); spriteSister1.runAction(CCRepeat.actionWithAction(CCSequence.actions(jump2, jump1), 5)); spriteSister2.runAction(CCRepeat.actionWithAction(CCSequence.actions((CCFiniteTimeAction)(jump1.copy()), (CCFiniteTimeAction)(jump2.copy())), 5)); spriteSister1.runAction(CCRepeat.actionWithAction(CCSequence.actions(rot1, rot2), 5)); spriteSister2.runAction(CCRepeat.actionWithAction(CCSequence.actions((CCFiniteTimeAction)(rot2.copy()), (CCFiniteTimeAction)(rot1.copy())), 5)); }
public override CCFiniteTimeAction reverse() { return(CCRepeat.actionWithAction(m_pInnerAction.reverse(), m_uTimes)); }