protected void InitGame() { Finished = false; Overed = false; NextUpperBallCoord = 0; LoadParams(); #region Reading Level System.IO.StreamReader File = new System.IO.StreamReader("levels/level" + Convert.ToString(Level) + ".txt", Encode); FinishWord = File.ReadLine(); Translation = File.ReadLine(); Symb = File.ReadLine(); File.Close(); #endregion #region Loading Textures VinniPoohImg = Content.Load <Texture2D>("TheVinniPooh"); BackGroundImg = Content.Load <Texture2D>("BackGround"); SkyImg = Content.Load <Texture2D>("Sky"); LifeImg = Content.Load <Texture2D>("Life"); #endregion #region Loading Fonts Normal = Content.Load <SpriteFont>("NormalFont"); Big = Content.Load <SpriteFont>("BigFont"); #endregion #region Creating Objects VinniPooh = new ObjectClass(VinniPoohImg); BackGround = new ObjectClass(BackGroundImg); #endregion #region Setting Fields VinniPooh.Cent(); VinniPooh.Position = new Vector2(37.0f, 100.0f); BackGround.Position = new Vector2(0, (BackGroundImg.Height / 2) + 75); BackGround.Center = new Vector2(BackGroundImg.Width / 2, BackGroundImg.Height / 2 + 75); #endregion #region Creating Balls K = RandomNum.Next(10, 20); Balls = new BallClass[K]; char C; int T = MinASCII; MaxASCII = Symb.Length - 1; for (int i = 0; i < K; i++) { C = (char)(Symb[T]); T++; if (T > MaxASCII) { T = MinASCII; } BallImg = Content.Load <Texture2D>("" + C); Balls[i] = new BallClass(BallImg, C); Balls[i].Speed = new Vector2(-(RandomNum.Next(40, 100)), 0); Balls[i].Position = new Vector2(RandomNum.Next(1280, 2664), RandomNum.Next(80, 560)); Balls[i].Cent(); } #endregion #region Creating Bees BK = RandomNum.Next(2, 5); Bees = new BeeClass[BK]; BeeImg = Content.Load <Texture2D>("bee"); for (int i = 0; i < BK; i++) { Bees[i] = new BeeClass(BeeImg); Bees[i].Speed = new Vector2(-(RandomNum.Next(100, 200)), 0); Bees[i].Position = new Vector2(RandomNum.Next(1280, 2664), RandomNum.Next(80, 560)); Bees[i].Cent(); } #endregion Word = ""; }
protected void InitGame() { Finished = false; Overed = false; NextUpperBallCoord = 0; LoadParams(); #region Reading Level System.IO.StreamReader File = new System.IO.StreamReader("levels/level" + Convert.ToString(Level) + ".txt", Encode); FinishWord = File.ReadLine(); Translation = File.ReadLine(); Symb = File.ReadLine(); File.Close(); #endregion #region Loading Textures VinniPoohImg = Content.Load<Texture2D>("TheVinniPooh"); BackGroundImg = Content.Load<Texture2D>("BackGround"); SkyImg = Content.Load<Texture2D>("Sky"); LifeImg = Content.Load<Texture2D>("Life"); #endregion #region Loading Fonts Normal = Content.Load<SpriteFont>("NormalFont"); Big = Content.Load<SpriteFont>("BigFont"); #endregion #region Creating Objects VinniPooh = new ObjectClass(VinniPoohImg); BackGround = new ObjectClass(BackGroundImg); #endregion #region Setting Fields VinniPooh.Cent(); VinniPooh.Position = new Vector2(37.0f, 100.0f); BackGround.Position = new Vector2(0, (BackGroundImg.Height / 2) + 75); BackGround.Center = new Vector2(BackGroundImg.Width / 2, BackGroundImg.Height / 2 + 75); #endregion #region Creating Balls K = RandomNum.Next(10, 20); Balls = new BallClass[K]; char C; int T = MinASCII; MaxASCII = Symb.Length - 1; for (int i = 0; i < K; i++) { C = (char)(Symb[T]); T++; if (T > MaxASCII) T = MinASCII; BallImg = Content.Load<Texture2D>("" + C); Balls[i] = new BallClass(BallImg, C); Balls[i].Speed = new Vector2(-(RandomNum.Next(40, 100)), 0); Balls[i].Position = new Vector2(RandomNum.Next(1280, 2664), RandomNum.Next(80, 560)); Balls[i].Cent(); } #endregion #region Creating Bees BK = RandomNum.Next(2, 5); Bees = new BeeClass[BK]; BeeImg = Content.Load<Texture2D>("bee"); for (int i = 0; i < BK; i++) { Bees[i] = new BeeClass(BeeImg); Bees[i].Speed = new Vector2(-(RandomNum.Next(100, 200)), 0); Bees[i].Position = new Vector2(RandomNum.Next(1280, 2664), RandomNum.Next(80, 560)); Bees[i].Cent(); } #endregion Word = ""; }