Advertisement
Guest User

Untitled

a guest
Aug 25th, 2019
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.23 KB | None | 0 0
  1. public void Form1_Load(object sender, EventArgs e)
  2. {
  3. shootP = new PictureBox();
  4. shootP.Image = Properties.Resources.shoot_1;
  5. shootP.SizeMode = PictureBoxSizeMode.Zoom;
  6. shootP.Size = new Size(10, 72);
  7. ListShoot = new List<PictureBox>();
  8. int i = -1;
  9. }
  10. private void Form1_KeyDown(object sender, KeyEventArgs e)
  11. {
  12. if (e.KeyCode == Keys.Space)
  13. {
  14. control = false;
  15. shootP = new PictureBox();
  16. shootP.Image = Properties.Resources.shoot_1;
  17. shootP.SizeMode = PictureBoxSizeMode.Zoom;
  18. shootP.Size = new Size(10, 72);
  19. ListShoot.Add(shootP);
  20. timeShoot.Start();
  21. }
  22. }
  23. private void timeShoot_Tick(object sender, EventArgs e)
  24. {
  25. if (control == false)
  26. {
  27. foreach PictureBox shot in ListShot
  28. {
  29. shot.Location = new Point(spacecraft._imageBox.Location.X + 50, spacecraft._imageBox.Location.Y - 55); // align the shoot with spacecraft
  30. shot.Top -= 40;
  31. }
  32. control = true;
  33. }
  34. }
  35. foreach PictureBox shot in ListShoot
  36. {
  37. draw(shot);
  38. }
  39. shootP = new PictureBox();
  40. shootP.Image = Properties.Resources.shoot_1;
  41. shootP.SizeMode = PictureBoxSizeMode.Zoom;
  42. shootP.Size = new Size(10, 72);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement