Exemple #1
0
 public void Restart()
 {
     state = GameState.Waiting;
     SetScore(0);
     stick = new Stick();
     stick.SetAngle(-90);
     CreateNewPlatform();
     hero.Position.X     = heroPlatform.Position.X + heroPlatform.Width - Hero.Width - Stick.Width - GameForm.OffsetBeforeStick;
     hero.Position.Y     = GameForm.ClientHeight - heroPlatform.Height - Hero.Height;
     stick.StartingPoint = new Point(hero.Position.X + Hero.Width + GameForm.OffsetBeforeStick, hero.Position.Y + Hero.Height);
     stick.EndingPoint   = new Point(hero.Position.X + Hero.Width + GameForm.OffsetBeforeStick, hero.Position.Y + Hero.Height);
 }
Exemple #2
0
        private void CreateNewPlatform()
        {
            Random random = new Random();

            if (GetScore() > 0)
            {
                heroPlatform = new Platform(anotherPlatform.Width, anotherPlatform.Height,
                                            anotherPlatform.Position.X, anotherPlatform.Position.Y);
            }

            anotherPlatform = new Platform(randomWidth, heroPlatform.Height,
                                           random.Next(heroPlatform.Position.X + heroPlatform.Width + 10, GameForm.ClientWidth - randomWidth), GameForm.ClientHeight - heroPlatform.Height);
            doubleScorePlatform = new Platform(DoubleScorePlatformWidth, DoubleScorePlatformHeight,
                                               anotherPlatform.Position.X + anotherPlatform.Width / 2 - DoubleScorePlatformWidth / 2, anotherPlatform.Position.Y);
            stick.StartingPoint = new Point(hero.Position.X + Hero.Width + GameForm.OffsetBeforeStick, hero.Position.Y + Hero.Height);
            stick.EndingPoint   = new Point(hero.Position.X + Hero.Width + GameForm.OffsetBeforeStick, hero.Position.Y + Hero.Height);
            stick.SetAngle(-90);
        }