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; } }
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(); } }
private void StickTimer_Tick(object sender, EventArgs e) { _currentStickSize += 1; StickHeroField.Refresh(); }