private void GoDown(object o, EventArgs e) { if (steps < y) { steps += 4.285F; if (steps + 0.5 >= y) { ImageAnimator.StopAnimate(downImage, new EventHandler(this.GoDown)); for (byte i = 0; i < from.Length; i++) { if (from[i] != null) { from[i].Draw(); } if (where[i] != null) { where[i].Draw(); } } if (withBox) { if (boxes[0].Id == BlockState.Container) { boxes[1].OnContainer = true; } else { boxes[1].OnContainer = false; } boxes[1].Draw(); } steps = 0; } else { fDown = ++fDown % downImage.GetFrameCount(System.Drawing.Imaging.FrameDimension.Time); downImage.SelectActiveFrame(System.Drawing.Imaging.FrameDimension.Time, fDown); g.FillRectangle(new SolidBrush(Color.Black), x, steps - 4.285F, width, height + 4.285F); g.DrawImage(downImage, x + 4, steps, 22, 30); if (withBox) { Box.Draw(x, steps + 30); } while (Console.KeyAvailable) { Console.ReadKey(true); } } } }
private void GoLeft(object o, EventArgs e) { if (steps > x) { steps -= 4.285F; if (steps - 0.5 <= x) { ImageAnimator.StopAnimate(leftImage, new EventHandler(this.GoLeft)); for (byte i = 0; i < from.Length; i++) { if (from[i] != null) { from[i].Draw(); } if (where[i] != null) { where[i].Draw(); } } if (withBox) { if (boxes[0].Id == BlockState.Container) { boxes[1].OnContainer = true; } else { boxes[1].OnContainer = false; } boxes[1].Draw(); } steps = 0; } else { fLeft = ++fLeft % upImage.GetFrameCount(System.Drawing.Imaging.FrameDimension.Time); leftImage.SelectActiveFrame(System.Drawing.Imaging.FrameDimension.Time, fLeft); g.FillRectangle(new SolidBrush(Color.Black), steps, y, width + 4.285F, height); g.DrawImage(leftImage, steps + 1, y, 27, 30); if (withBox) { Box.Draw(steps - 30, y); } while (Console.KeyAvailable) { Console.ReadKey(true); } } } }