Advertisement
Guest User

Untitled

a guest
May 5th, 2015
257
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.80 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.Windows.Forms;
  9. using System.Media;
  10. using System.Collections;
  11.  
  12. namespace HEROIN
  13. {
  14. public partial class Form1 : Form
  15. {
  16. public Form1()
  17. {
  18. InitializeComponent();
  19. }
  20.  
  21. private void Form1_Load(object sender, EventArgs e)
  22. {
  23.  
  24. Cursor = Cursors.Cross;
  25. // Cursor = new Cursor(Properties.Resources.penis);
  26. y = zufallyo.Next(21, 480);
  27. x = zufallyo.Next(21, 450);
  28. lolz = func(95, 95, x, y);
  29. timer1.Start(); timer1.Enabled = true;
  30.  
  31. }
  32.  
  33.  
  34.  
  35. ArrayList lolz = new ArrayList();
  36.  
  37. int score = 1;
  38. int y, x,y2,x2;
  39. double m,b;
  40. int countr = 0;
  41. int saver = 0;
  42. Random zufallyo = new Random();
  43. static ArrayList func(double x, double y,double x2, double y2)
  44. {
  45.  
  46. double wert = 0;
  47.  
  48. double var =y;
  49. double vartest = 0;
  50. double m = (y2 - y) / (x2 - x);
  51.  
  52. double b = (y2 - m * x2);
  53. ArrayList myArray = new ArrayList();
  54. if (x < x2)
  55. {
  56. for ( double i = x; i <= x2; i++)
  57. {
  58.  
  59. wert = Math.Round((m * i + b));
  60. vartest = wert - var;
  61. var = wert;
  62.  
  63. myArray.Add(vartest);
  64. //myArray.Add(1);
  65. }
  66. }
  67. if (x > x2)
  68. {
  69. for (double i = x; i >= x2; i--)
  70. {
  71. wert = Math.Round((m * i + b));
  72. vartest = wert - var;
  73. var = wert;
  74.  
  75. myArray.Add(vartest);
  76.  
  77. }
  78. }
  79. return myArray;
  80.  
  81. }
  82.  
  83. private void timer1_Tick(object sender, EventArgs e)
  84. {
  85. int save;
  86.  
  87. if (pictureBox1.Top == y && pictureBox1.Left == x)
  88. {
  89. double y1 = y;
  90. double x1 = x;
  91. y = zufallyo.Next(21, 480);
  92. x = zufallyo.Next(21, 450);
  93. lolz = func(x1, y1, x, y);
  94. countr = 0;
  95. saver= 0;
  96.  
  97. }
  98.  
  99.  
  100. if (lolz.Count - 1 <= countr)
  101. {
  102. if(saver==0){
  103. save = (int)lolz[countr];
  104. saver = save;
  105. countr++;}
  106. else{
  107.  
  108. if(saver>0){
  109.  
  110. pictureBox1.Left -= 1;
  111.  
  112.  
  113.  
  114. saver--;
  115.  
  116.  
  117. if(saver==0){
  118. if (pictureBox1.Left != x)
  119. {
  120.  
  121. if (pictureBox1.Left < x)
  122. pictureBox1.Left += 1;
  123. else
  124. pictureBox1.Left -= 1;
  125. }
  126.  
  127.  
  128.  
  129. }
  130.  
  131. }
  132.  
  133.  
  134. if(saver<0){
  135.  
  136.  
  137. pictureBox1.Left += 1;
  138.  
  139.  
  140. saver++;
  141.  
  142. if(saver==0){
  143. if (pictureBox1.Left != x)
  144. {
  145.  
  146. if (pictureBox1.Left < x)
  147. pictureBox1.Left += 1;
  148. else
  149. pictureBox1.Left -= 1;
  150. }
  151.  
  152.  
  153.  
  154. }
  155. }
  156.  
  157.  
  158.  
  159.  
  160.  
  161.  
  162. }
  163.  
  164.  
  165.  
  166.  
  167.  
  168.  
  169.  
  170.  
  171.  
  172. }
  173.  
  174.  
  175.  
  176.  
  177.  
  178.  
  179.  
  180. }
  181.  
  182.  
  183.  
  184.  
  185.  
  186.  
  187.  
  188.  
  189.  
  190. private void ToDouble(string save)
  191. {
  192. throw new NotImplementedException();
  193. }
  194.  
  195. private void pictureBox1_MouseDown(object sender, MouseEventArgs e)
  196. {
  197.  
  198.  
  199. }
  200.  
  201. private void pictureBox1_MouseUp(object sender, MouseEventArgs e)
  202. {
  203. new SoundPlayer(Properties.Resources.neck).Play();
  204. label1.Text = "Score: " + score;
  205. score++;
  206. if (timer1.Interval >= 10)
  207. timer1.Interval = timer1.Interval - 5;
  208. label2.Text = "Schwierigkeitsgrad wurde erhöht!!! Interval: " + timer1.Interval + "ms";
  209. }
  210.  
  211. private void button1_Click(object sender, EventArgs e)
  212. {
  213. timer1.Stop();
  214.  
  215. /* y = zufallyo.Next(0, 565);
  216. x = zufallyo.Next(0, 565);
  217. y2 = pictureBox1.Top;
  218. x2 = pictureBox1.Left;
  219. */
  220. y = 200;
  221. x = 200;
  222. y2 = 600;
  223. x2 = 400;
  224.  
  225. m = (y2 - y) / (x2 - x);
  226.  
  227. b = (y2 - m * x2);
  228. /*
  229. ArrayList Marr = new ArrayList();
  230. Marr = func(x, y, x2, y2);
  231.  
  232. double abziehen = Math.Round((m * x + b));
  233. for (int i = 0; i <= Marr.Count - 1; i++)
  234. {
  235. MessageBox.Show(Marr[i].ToString());
  236. }
  237. label1.Text = Marr.ToString();*/
  238. }
  239. /* static double Berechnen(double x, double y )
  240. {
  241. Random zufallyo = new Random();
  242.  
  243. y = zufallyo.Next(0, 565);
  244. x = zufallyo.Next(0, 565);
  245. y2 = pictureBox1.Top;
  246. x2 = pictureBox1.Left;
  247.  
  248. m = (y2 - y) / (x2 - x);
  249.  
  250. b = (y2 - m * x2);
  251.  
  252. // pictureBox1.Left += 1;
  253.  
  254. double abziehen = Math.Round((m * 205 + b) - y);
  255.  
  256. }
  257. * */
  258. }
  259. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement