public void Tick() { if (Keyboard.GetState().IsKeyDown(Keys.Escape)) { if (!this.highScore.Active) { this.game.level = new LevelM(game); this.End(); return; } } this.scoreText.Content = "Score: " + this.points; this.ticks++; if (this.tilNext == 0) { Block b1 = new Block(game, this, new Rectangle(-32, -30, rng.Next(1024), 24), Color.RoyalBlue, this.speed); Block b2 = new Block(game, this, new Rectangle(b1.rect.X + b1.rect.Width + 64, -30, 1024, 24), Color.RoyalBlue, this.speed); b1.SetPartner(b2); this.blocks.Add(b1); this.blocks.Add(b2); this.game.Components.Add(b1); this.game.Components.Add(b2); this.tilNext = this.spawnInterval; } if (this.ticks % (200 * 5) == 0) { if (this.spawnInterval > 88) { this.spawnInterval = (int)(this.spawnInterval * 0.90); Console.WriteLine("Spawn interval is: " + this.spawnInterval); } } this.tilNext--; if (player.rect.X > 1024) { player.rect.X = 0 - player.rect.Width; } else if (player.rect.X + player.rect.Width < 0) { player.rect.X = 1024; } if (player.rect.Y > 1024) { if (!this.gameOver) { this.gameOver = true; this.highScore.SetStateInput(this.points, 0); } } }