public void Finish(bool startNextMovePoint) { // don't do anything if there is not a current movePoint if (_movePoint == null) { return; } _parent.RenderSize = _movePoint.DestSize; _parent.MoveSprite(_movePoint.DestCoord); if (MovePointFinished != null) { MovePointFinished(new SpriteMovePointFinishedEventArgs(_parent, this, _movePoint)); } if (_movePoint.nextMovePoint == null) { Stop(); } else { _movePoint = _movePoint.nextMovePoint; _movePoint.InitializeMovePoint(); } // remove from moving list if startNextMovePoint is false // this will stop the Sprite movement until Start() is called again if (!startNextMovePoint) { Tile.TilesMoving.Remove(_parent); } }
public static Sprite CloneSprite(Sprite sprite, GridPointMatrix destMatrix) { Sprite newSprite = (Sprite)sprite.Clone(); if (newSprite.ParentGrid != destMatrix) { newSprite.MoveSprite(destMatrix); newSprite.ParentGrid.RefreshQueue.AddPixelRangeToRefreshQueue(newSprite.DrawLocation, true); } return(newSprite); }
public static void LoadSprite() { FrameSequence seq = new FrameSequence(); seq.AddFrame(sprtBmp, 0, 0); seq.AddFrame(sprtBmp, 1, 0); seq.AddFrame(sprtBmp, 2, 0); seq.AddFrame(sprtBmp, 3, 0); seq.SequenceCycleType = Gondwana.Common.Enums.CycleType.PingPong; Cycle cycle = new Cycle(seq, 0.03, "groovin"); sprite = Sprites.CreateSprite(matrix, seq[0]); sprite.TileAnimator.CurrentCycle = cycle; sprite.RenderSize = new Size(50, 50); sprite.VertAlign = Gondwana.Common.Enums.VerticalAlignment.Top; sprite.HorizAlign = Gondwana.Common.Enums.HorizontalAlignment.Left; sprite.MoveSprite(3, 3); sprite.Visible = true; sprite.TileAnimator.StartAnimation(); sprite.DetectCollision = CollisionDetection.All; //matrix2[1, 1].EnableAnimator = true; //matrix2[1, 1].TileAnimator.CurrentCycle = Cycles.GetAnimationCycle("groovin"); //matrix2[1, 1].TileAnimator.StartAnimation(); }