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)); }
/** creates a CCRepeat action. Times is an unsigned integer between 1 and pow(2,30) */ public static CCRepeat actionWithAction(CCFiniteTimeAction action, uint times) { CCRepeat ret = new CCRepeat(); ret.initWithAction(action, times); return ret; }
public override CCObject copyWithZone(CCZone zone) { CCZone tmpZone = zone; CCRepeat ret = null; if (tmpZone != null && tmpZone.m_pCopyObject != null) { ret = tmpZone.m_pCopyObject as CCRepeat; if (ret == null) { return(null); } } else { ret = new CCRepeat(); tmpZone = new CCZone(ret); } base.copyWithZone(tmpZone); CCFiniteTimeAction param = m_pInnerAction.copy() as CCFiniteTimeAction; if (param == null) { return(null); } ret.initWithAction(param, m_uTimes); return(ret); }
public override void OnEnter() { base.OnEnter(); alignSpritesLeft(2); // Test: // Sequence should work both with IntervalAction and InstantActions var move1 = new CCMoveBy(1, new CCPoint(250, 0)); var move2 = new CCMoveBy(1, new CCPoint(0, 50)); var tog1 = new CCToggleVisibility(); var tog2 = new CCToggleVisibility(); var seq = CCSequence.FromActions(move1, tog1, move2, tog2, move1.Reverse()); var action = new CCRepeat((CCSequence.FromActions(seq, seq.Reverse())), 3); // Test: // Also test that the reverse of Hide is Show, and vice-versa m_kathia.RunAction(action); var move_tamara = new CCMoveBy(1, new CCPoint(100, 0)); var move_tamara2 = new CCMoveBy(1, new CCPoint(50, 0)); var hide = new CCHide(); var seq_tamara = CCSequence.FromActions(move_tamara, hide, move_tamara2); var seq_back = seq_tamara.Reverse(); m_tamara.RunAction(CCSequence.FromActions(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 CCObject copyWithZone(CCZone zone) { CCZone tmpZone = zone; CCRepeat ret = null; if (tmpZone != null && tmpZone.m_pCopyObject != null) { ret = tmpZone.m_pCopyObject as CCRepeat; if (ret == null) { return null; } } else { ret = new CCRepeat(); tmpZone = new CCZone(ret); } base.copyWithZone(tmpZone); CCFiniteTimeAction param = m_pInnerAction.copy() as CCFiniteTimeAction; if (param == null) { return null; } ret.initWithAction(param, m_uTimes); return ret; }
/** creates a CCRepeat action. Times is an unsigned integer between 1 and pow(2,30) */ public static CCRepeat actionWithAction(CCFiniteTimeAction action, uint times) { CCRepeat ret = new CCRepeat(); ret.initWithAction(action, times); return(ret); }
void OnActivatedBonus(object sender, Tuple <int, int> cell) { var gem = gems.Find(item => item.Col == cell.Item1 && item.Row == cell.Item2); var actionIn = new CCEaseIn(new CCScaleTo(0.3f, 1.1f), 4); var actionOut = new CCEaseOut(new CCScaleTo(0.3f, 1f), 4); var sequence = new CCSequence(actionIn, actionOut); var repeatAction = new CCRepeat(sequence, 10000); gem.AddAction(repeatAction); }
public CCRepeatState(CCRepeat action, CCNode target) : base(action, target) { InnerAction = action.InnerAction; Times = action.Times; Total = action.Total; ActionInstant = action.ActionInstant; NextDt = InnerAction.Duration / Duration; InnerActionState = (CCFiniteTimeActionState)InnerAction.StartAction(target); }
public CCRepeatState (CCRepeat action, CCNode target) : base (action, target) { InnerAction = action.InnerAction; Times = action.Times; Total = action.Total; ActionInstant = action.ActionInstant; NextDt = InnerAction.Duration / Duration; InnerActionState = (CCFiniteTimeActionState)InnerAction.StartAction (target); }
public override void OnEnter() { base.OnEnter(); centerSprites(2); var act1 = new CCRotateTo(1, 90); var act2 = new CCRotateTo(1, 0); var seq = (CCSequence.FromActions(act1, act2)); var rep1 = new CCRepeatForever((CCActionInterval)seq); var rep2 = new CCRepeat((CCFiniteTimeAction)(seq.Copy()), 10); m_tamara.RunAction(rep1); m_kathia.RunAction(rep2); }
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); var seq = CCSequence.FromActions( new CCRotateTo(0.5f, -20), new CCRotateTo(0.5f, 20)); var rep1 = new CCRepeat(seq, 10); var rep2 = new CCRepeatForever((CCActionInterval)(seq.Copy())); 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); var a1 = new CCMoveBy(1, new CCPoint(150, 0)); var action1 = new CCRepeat( CCSequence.FromActions(new CCPlace(new CCPoint(60, 60)), a1), 3); var action2 = new CCRepeatForever( (CCSequence.FromActions((CCActionInterval)(a1.Copy()), a1.Reverse())) ); m_kathia.RunAction(action1); m_tamara.RunAction(action2); }
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(); centerSprites(0); var spr = new CCSprite("Images/grossini"); spr.Position = new CCPoint(100, 100); AddChild(spr); var act1 = new CCMoveBy(0.5f, new CCPoint(100, 0)); var act2 = (CCMoveBy)act1.Reverse(); var act3 = CCSequence.FromActions(act1, act2); var act4 = new CCRepeat(act3, 2); spr.RunAction(act4); }
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 void AddAnimation(string name, float delay, bool repeat) { CCAction newAction; var animFrames = spriteSheet.Frames.FindAll(item => item.TextureFilename.ToLower().Contains(name)); if (spriteSize == CCSize.Zero) { spriteSize = animFrames[0].ContentSize; } if (repeat) { newAction = new CCRepeatForever(new CCAnimate(new CCAnimation(animFrames, delay))); } else { newAction = new CCRepeat(new CCAnimate(new CCAnimation(animFrames, delay)), 1); } sprite.AddAction(newAction); anims.Add(name, newAction); }
public static void Init() { // EXPLOSIONS // rocket explosion animation rocketExplosionSpriteSheet = new CCSpriteSheet("animations/rocket_explosion.plist", "animations/rocket_explosion.xnb"); rocketExplosionAnimationFrames = rocketExplosionSpriteSheet.Frames.FindAll(x => x.TextureFilename.StartsWith("frame")); CCAnimation rocketExplosionAnimation = new CCAnimation(rocketExplosionAnimationFrames, 0.1f); rocketExplosionAction = new CCRepeat(new CCAnimate(rocketExplosionAnimation), 1); // explosion_1 animation explosion1SpriteSheet = new CCSpriteSheet("animations/explosion_1.plist", "animations/explosion_1.xnb"); explosion1AnimationFrames = explosion1SpriteSheet.Frames.FindAll(x => x.TextureFilename.StartsWith("frame")); CCAnimation explosion1Animation = new CCAnimation(explosion1AnimationFrames, 0.1f); explosion1Action = new CCRepeat(new CCAnimate(explosion1Animation), 1); // explosion_2 animation explosion2SpriteSheet = new CCSpriteSheet("animations/explosion_2.plist", "animations/explosion_2.xnb"); explosion2AnimationFrames = explosion2SpriteSheet.Frames.FindAll(x => x.TextureFilename.StartsWith("frame")); CCAnimation explosion2Animation = new CCAnimation(explosion2AnimationFrames, 0.1f); explosion2Action = new CCRepeat(new CCAnimate(explosion2Animation), 1); // explosion_3 animation explosion3SpriteSheet = new CCSpriteSheet("animations/explosion_3.plist", "animations/explosion_3.xnb"); explosion3AnimationFrames = explosion3SpriteSheet.Frames.FindAll(x => x.TextureFilename.StartsWith("frame")); CCAnimation explosion3Animation = new CCAnimation(explosion3AnimationFrames, 0.12f); explosion3Action = new CCRepeat(new CCAnimate(explosion3Animation), 1); // Alien bomb alienBombSpriteSheet = new CCSpriteSheet("animations/bomb_gimped.plist", "animations/bomb_gimped.xnb"); alienBombAnimationFrames = alienBombSpriteSheet.Frames.FindAll(x => x.TextureFilename.StartsWith("frame")); alienBombAnimation = new CCAnimation(alienBombAnimationFrames, 0.08f); alienBombAction = new CCRepeatForever(new CCAnimate(alienBombAnimation)); // alienBombAction = new CCAnimate(alienBombAnimation); }
protected CCRepeat(CCRepeat repeat) : base(repeat) { var param = repeat.m_pInnerAction.Copy() as CCFiniteTimeAction; InitWithAction(param, repeat.m_uTimes); }
public override CCFiniteTimeAction reverse() { return(CCRepeat.actionWithAction(m_pInnerAction.reverse(), m_uTimes)); }
protected CCRepeat (CCRepeat repeat) : base (repeat) { var param = repeat.m_pInnerAction.Copy() as CCFiniteTimeAction; InitWithAction(param, repeat.m_uTimes); }