Пример #1
0
        private void Form1_KeyUp(object sender, KeyEventArgs e)
        {
            switch (e.KeyCode)
            {
            case Keys.Space:
                int destinationToNextPlatform;
                StickTimer.Stop();
                StickHeroField.Refresh();
                StickDropTimer.Start();
                destinationToNextPlatform = GetDestination(_stickStartPoint.X, _nextPlatform.PositionPoint.X);
                _stickHeroGame.CheckStickSize(_currentStickSize, destinationToNextPlatform, _nextPlatform.GetWidth());

                break;
            }
        }
Пример #2
0
        private void StickDropTimer_Tick(object sender, EventArgs e)
        {
            _stickRectangle.Size = new Size(5, _currentStickSize);

            _currentStickAngle++;
            if (_currentStickAngle < 270)
            {
                PointF[] stickPoints = RotateStick(_stickRectangle, _currentStickAngle);

                using (Graphics g = StickHeroField.CreateGraphics())
                    g.DrawPolygon(Pens.Red, stickPoints);
                StickHeroField.Refresh();
            }
            else
            {
                PointF[] stickPoints = RotateStick(_stickRectangle, _currentStickAngle);

                using (Graphics g = StickHeroField.CreateGraphics())
                    g.DrawPolygon(Pens.Red, stickPoints);

                _currentStickAngle = 180;
                StickDropTimer.Stop();
            }
        }
Пример #3
0
 private void StickTimer_Tick(object sender, EventArgs e)
 {
     _currentStickSize += 1;
     StickHeroField.Refresh();
 }