public override void init() { // get serialized @HighScores HighScores = ScoreSerializer.HighScores; // no need of @Player Player = new PlayerGameObject(); Player.Circle.Center = new PointF(-200, -200); base.init(); }
public override void init() { Player = new PlayerGameObject(); Player.Circle.Center = new PointF(W / 2, 0); Player.Commands.Add(new MovementAICommand()); // @Player jump by himself - no user input Player.Commands.Add(new CollisionDetectionCommand()); // draw one horizontal @Line throughout the entire screen for the @Player to jump on LineGameObject l1 = new LineGameObject(new Line2D(new PointF(0, 260), new PointF(W, 260))); this.GameObjects.Add(l1); base.init(); }
// initialize variables and generate lines public override void init() { if (IsCursorVisible) { Cursor.Hide(); IsCursorVisible = false; } StartState = false; Score = 0; tb = new TextBox(); tb.Size = new Size(450, 1); tb.Font = new Font("Arial", 36); tb.Location = new Point(w / 2 - tb.Size.Width / 2, 200); tb.BackColor = MainWindow.BackColor; tb.BorderStyle = BorderStyle.None; tb.MaxLength = 18; tb.TextAlign = HorizontalAlignment.Center; tb.KeyDown += OnKeyDown; Player = new PlayerGameObject(); Player.Commands.Add(new MovementCommand()); Player.Commands.Add(new CollisionDetectionCommand()); Player.Commands.Add(new TimeLapseCommand()); Player.Commands.Add(new HyperJumpCommand()); Player.Circle.Center = new PointF(w / 2, h - 100); GameObjects.Add(new LineGameObject(new Line2D(new Point(100, 0), new Point(100, h)))); GameObjects.Add(new LineGameObject(new Line2D(new Point(w - 100, 0), new Point(w - 100, h)))); GameObjects.Add(new LineGameObject(new Line2D(new Point(100, h - 50), new Point(w - 100, h - 50)))); Height = h - 50; generateLines(50, false); // generate 50 static lines base.init(); }