コード例 #1
0
        public override void Draw(Paddle onPaddle, Graphics g)
        {
            Rectangle rct = new Rectangle(Point.Empty, onPaddle.Getrect().Size);
            using (TextureBrush tb = new TextureBrush(drawimage, WrapMode.Tile,rct))
            {

                //calculate length to translate.
                int translateamount = (int) (((float)drawimage.Width / 1000f) * DateTime.Now.Millisecond);
                tb.TranslateTransform(translateamount, 0);
                g.FillRectangle(tb, onPaddle.Getrect());
            }
        }
コード例 #2
0
        public override void PerformFrame(BCBlockGameState gamestate, Paddle pPaddle)
        {
            var rg = BCBlockGameState.rgen;
            base.PerformFrame(gamestate, pPaddle);
            useoverlaybrush = new SolidBrush(new HSLColor(rg.NextDouble()*240, 240f, 120f));
            //spawn a sparkle.
            var paddlerect = pPaddle.Getrect();
            PointF randompoint = new PointF(paddlerect.Left + (float) (paddlerect.Width*rg.NextDouble()),
                                            paddlerect.Top + (float) (paddlerect.Height*rg.NextDouble()));

            Sparkle s = new Sparkle(randompoint, BCBlockGameState.GetRandomVelocity(0, 2),
                                    new HSLColor(rg.NextDouble()*240, 240, 120));
            gamestate.NextFrameCalls.Enqueue(new BCBlockGameState.NextFrameStartup(() => gamestate.Particles.Add(s)));
        }
コード例 #3
0
 private bool TouchesPaddle(Paddle paddlecheck)
 {
     if (paddlecheck == null) return false;
     return new RectangleF(Location, Size).IntersectsWith(paddlecheck.Getrect());
 }
コード例 #4
0
 public override void Draw(Paddle onPaddle, Graphics g)
 {
     g.FillRectangle(useoverlaybrush, onPaddle.Getrect());
 }