public void Play(int sheet) { this.sheet = sheet; Animation[] animation = new Animation[] { new Animation(0, spritesheets[sheet].totalFrames, spritesheets[sheet].loop) }; Vector2 pos = Vector2.Zero; if (anim != null) { pos = anim.position; } anim = new AnimSprite(spritesheets[sheet].sheet, spritesheets[sheet].frameSize, animation, spritesheets[sheet].sprite); anim.frameOffset += frameOffset; anim.SetFrame(0); anim.position = pos; if (spritesheets[sheet].autoplay) { anim.Play(0); } }
protected void SetupAnimations() { Animation[] pointerAnimations = { new Animation((int)Pointers.Alert, 6, false, (int)Pointers.Idle), new Animation((int)Pointers.Exit, 14, false), new Animation((int)Pointers.Enter, 43, false, (int)Pointers.Idle), new Animation((int)Pointers.Idle, 1), }; pointerAnim = new AnimSprite("user_pointer", new Point(70, 70), pointerAnimations); pointerAnim.Play((int)Pointers.Enter); Animation[] pointsAnimations = { new Animation(0, 50), new Animation(1, 50) }; pointsAnim = new AnimSprite("user_points", new Point(70, 70), pointsAnimations); pointsAnim.SetFrame(26); Animation[] stateAnimations = { new Animation((int)States.Pinch, 8), new Animation((int)States.BloatStart, 4,false, (int)States.Bloat), new Animation((int)States.BloatEnd, 4,false, (int)States.Idle), new Animation((int)States.Bloat, 8), new Animation((int)States.PinchStart, 4,false, (int)States.Pinch), new Animation((int)States.PinchEnd, 4,false, (int)States.Idle), new Animation((int)States.Idle, 1), }; stateAnim = new AnimSprite("user_bloat_pinch", new Point(70, 70), stateAnimations); stateAnim.Play((int)States.Idle); }
protected void DrawPointsRing() { float ratio = ((float)points / UserManager.highestPoints); int frame = (int)(100 * ratio); if (frame >= 99) { frame = 99; } if (frame >= 50) { frame -= 50; pointsAnim.SetClip(1); } else { pointsAnim.SetClip(0); } pointsAnim.SetFrame(frame); if (collector != null) { pointsAnim.Draw(collector.teamColour); } else { pointsAnim.Draw(); } }
public void SetFrame(int frame) { anim.SetFrame(frame); }