Пример #1
0
        private void GameForm_MouseUp(object sender, MouseEventArgs e)
        {
            var ballSize = ball.bounds.Size;
            var x        = mouseDownPoint.X - ballSize.Width / 2;
            var y        = mouseDownPoint.Y - ballSize.Height / 2;

            ball.setPosition(x, y);
            ball.setSpeed(
                e.Location.X - mouseDownPoint.X,
                e.Location.Y - mouseDownPoint.Y
                );
        }
Пример #2
0
        private void GameForm_Load(object sender, EventArgs e)
        {
            this.ClientSize = new Size(WIDTH, HEIGHT);
            paddle          = new Paddle();
            paddle.setPosition(0, PADDLE_Y);

            ball = new Ball();
            ball.setPosition(WIDTH / 2, HEIGHT / 2);

            stage = new Bricks.Stage(1);

            previousTime = DateTime.Now;
        }