Advertisement
al33kappa

sadsad

May 12th, 2018
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.09 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Drawing;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Threading.Tasks;
  9. using System.Windows.Forms;
  10.  
  11. namespace WindowsFormsApp4
  12. {
  13. public partial class Form1 : Form
  14. {
  15. public Form1()
  16. {
  17. InitializeComponent();
  18. label2.BackColor = Color.Red;
  19. label1.BackColor = Color.Yellow;
  20. label3.BackColor = Color.Orange;
  21. label4.BackColor = Color.Purple;
  22. label5.BackColor = Color.Blue;
  23. labelCarcas.BackColor = Color.Black;
  24.  
  25. }
  26. int pot1 = 44;
  27. bool flag = true;
  28. Stack<Label> F_stack = new Stack<Label>();
  29. Stack<Label> S_stack = new Stack<Label>();
  30. int i = 2, j = 0;
  31. Label[] massiv;
  32. Label[] massiv_3;
  33. int[] massivj = new int[4] { -1, -2, -3, -4 };
  34. private void pictureBox1_Click(object sender, EventArgs e)
  35. {
  36.  
  37. }
  38. private void timer1_Tick(object sender, EventArgs e)
  39. {
  40. move_1_3();
  41. }
  42. public void button1_Click(object sender, EventArgs e)
  43. {
  44. timer1.Interval = 2;
  45. F_stack.Push(label1);
  46. F_stack.Push(label2);
  47. F_stack.Push(label3);
  48. //F_stack.Push(label4);
  49. //F_stack.Push(label5);
  50. massiv = new Label[5] { label11, label22, label33, label44, label55 };
  51. massiv_3 = new Label[5] { label111, label222, label333, label444, label555 };
  52. /*S_stack.Push(label55);
  53. S_stack.Push(label44);
  54. S_stack.Push(label33);
  55. S_stack.Push(label22);
  56. S_stack.Push(label11);*///?? ????????
  57. timer1.Start();
  58. }
  59. private void Form1_Load(object sender, EventArgs e)
  60. {
  61.  
  62. }
  63. public void move_1_2()
  64. {
  65. if (F_stack.Count == 0)
  66. {
  67. timer1.Stop();
  68. }
  69. else
  70. {
  71. if (F_stack.Peek().Location.X == F_stack.Peek().Location.X && F_stack.Peek().Location.Y >= pot1 && flag)
  72. {
  73. F_stack.Peek().Top -= 4;
  74. }
  75. else if (F_stack.Peek().Location.Y == F_stack.Peek().Location.Y && F_stack.Peek().Location.X < massiv[i].Location.X)
  76. {
  77. F_stack.Peek().Left += 4;
  78. flag = false;
  79. }
  80. else if (F_stack.Peek().Location.X == F_stack.Peek().Location.X && F_stack.Peek().Location.Y <= massiv[j].Location.Y)
  81. {
  82. F_stack.Peek().Top += 4;
  83. }
  84. else
  85. {
  86. S_stack.Push(F_stack.Peek());
  87. F_stack.Pop();
  88. i--;
  89. j++;
  90. flag = true;
  91. }
  92. }
  93. }//endmove_1_2
  94. public void move_1_3()
  95. {
  96. if (F_stack.Count == 0)
  97. {
  98. timer1.Stop();
  99. }
  100. else
  101. {
  102. if (F_stack.Peek().Location.X == F_stack.Peek().Location.X && F_stack.Peek().Location.Y >= pot1 && flag)
  103. {
  104. F_stack.Peek().Top -= 4;
  105. }
  106. else if (F_stack.Peek().Location.Y == F_stack.Peek().Location.Y && F_stack.Peek().Location.X < massiv_3[i].Location.X)
  107. {
  108. F_stack.Peek().Left += 4;
  109. flag = false;
  110. }
  111. else if (F_stack.Peek().Location.X == F_stack.Peek().Location.X && F_stack.Peek().Location.Y <= massiv_3[j].Location.Y)
  112. {
  113. F_stack.Peek().Top += 4;
  114. }
  115. else
  116. {
  117. S_stack.Push(F_stack.Peek());
  118. F_stack.Pop();
  119. i--;
  120. j++;
  121. flag = true;
  122. }
  123. }
  124. }
  125. }
  126. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement