public FormSecundar(int x, int y, bool isBoot_, bool hit_animalsget, int typeAnimalget, int hitsin, int missesin) { InitializeComponent(); tree = new Tree(); forest = new Forest(); tree.RandomBranches(); hits = hitsin; misses = missesin; isBoat = isBoot_; hit_animals = hit_animalsget; typeAnimal = typeAnimalget; Bitmap b = new Bitmap(Properties.Resources.target2); this.Cursor = CustomCursor.CreateCursor(b, b.Height / 2, b.Width / 2); // WindowState = FormWindowState.Maximized; Random rd = new Random(); int nrImage = rd.Next(1, 3); x1 = x; y1 = y; this.BackgroundImage = Image.FromFile(@"ResourcesImage\campie" + nrImage + ".jpg"); // cscore = new CScore() { Left = 30, Top = 160 }; csplat = new CSplat(); canimal = new Canimal(1, folderDeer) { Left = 40, Top = 400 }; trees = new Trees(); trees.Left = 120; trees.Top = 120; if (hit_animals == true) { showDeer = true; } }
private void timerDeer_Tick(object sender, EventArgs e) { if (showDeer == true && typeAnimal == 0) { timeX += timeDeer; timeY += 1; // canimal = new Canimal() { Left = timeX, Top = timeY }; canimal = new Canimal(gameFrame, folderDeer) { Left = timeX, Top = 400 }; UpdateAnimal(timeX, 420 + timeY); if (gameFrame >= 3) { gameFrame = 0; } if (splat) { if (splatTime >= 3) { splat = false; splatTime = 0; // UpdateAnimal(timeX,400); } timerDeer.Stop(); splatTime++; } } else if (showDeer == true && typeAnimal == 1) { timeX += timeDeer; timeY += 1; // canimal = new Canimal() { Left = timeX, Top = timeY }; canimal = new Canimal(gameFrame, folderRabbit) { Left = timeX, Top = 400 }; UpdateAnimal(timeX, 420 + timeY); if (gameFrame >= 5) { gameFrame = 0; } if (splat) { if (splatTime >= 3) { splat = false; splatTime = 0; // UpdateAnimal(timeX,400); } timerDeer.Stop(); splatTime++; } } gameFrame++; Refresh(); }