Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Data;
- using System.Drawing;
- using System.Linq;
- using System.Text;
- using System.Windows.Forms;
- using System.Media;
- using System.Collections;
- namespace HEROIN
- {
- public partial class Form1 : Form
- {
- public Form1()
- {
- InitializeComponent();
- }
- private void Form1_Load(object sender, EventArgs e)
- {
- Cursor = Cursors.Cross;
- // Cursor = new Cursor(Properties.Resources.penis);
- y = zufallyo.Next(21, 480);
- x = zufallyo.Next(21, 450);
- lolz = func(95, 95, x, y);
- timer1.Start(); timer1.Enabled = true;
- }
- ArrayList lolz = new ArrayList();
- int score = 1;
- int y, x,y2,x2;
- double m,b;
- int countr = 0;
- int saver = 0;
- Random zufallyo = new Random();
- static ArrayList func(double x, double y,double x2, double y2)
- {
- double wert = 0;
- double var =y;
- double vartest = 0;
- double m = (y2 - y) / (x2 - x);
- double b = (y2 - m * x2);
- ArrayList myArray = new ArrayList();
- if (x < x2)
- {
- for ( double i = x; i <= x2; i++)
- {
- wert = Math.Round((m * i + b));
- vartest = wert - var;
- var = wert;
- myArray.Add(vartest);
- //myArray.Add(1);
- }
- }
- if (x > x2)
- {
- for (double i = x; i >= x2; i--)
- {
- wert = Math.Round((m * i + b));
- vartest = wert - var;
- var = wert;
- myArray.Add(vartest);
- }
- }
- return myArray;
- }
- private void timer1_Tick(object sender, EventArgs e)
- {
- int save;
- if (pictureBox1.Top == y && pictureBox1.Left == x)
- {
- double y1 = y;
- double x1 = x;
- y = zufallyo.Next(21, 480);
- x = zufallyo.Next(21, 450);
- lolz = func(x1, y1, x, y);
- countr = 0;
- saver= 0;
- }
- if (lolz.Count - 1 <= countr)
- {
- if(saver==0){
- save = (int)lolz[countr];
- saver = save;
- countr++;}
- else{
- if(saver>0){
- pictureBox1.Left -= 1;
- saver--;
- if(saver==0){
- if (pictureBox1.Left != x)
- {
- if (pictureBox1.Left < x)
- pictureBox1.Left += 1;
- else
- pictureBox1.Left -= 1;
- }
- }
- }
- if(saver<0){
- pictureBox1.Left += 1;
- saver++;
- if(saver==0){
- if (pictureBox1.Left != x)
- {
- if (pictureBox1.Left < x)
- pictureBox1.Left += 1;
- else
- pictureBox1.Left -= 1;
- }
- }
- }
- }
- }
- }
- private void ToDouble(string save)
- {
- throw new NotImplementedException();
- }
- private void pictureBox1_MouseDown(object sender, MouseEventArgs e)
- {
- }
- private void pictureBox1_MouseUp(object sender, MouseEventArgs e)
- {
- new SoundPlayer(Properties.Resources.neck).Play();
- label1.Text = "Score: " + score;
- score++;
- if (timer1.Interval >= 10)
- timer1.Interval = timer1.Interval - 5;
- label2.Text = "Schwierigkeitsgrad wurde erhöht!!! Interval: " + timer1.Interval + "ms";
- }
- private void button1_Click(object sender, EventArgs e)
- {
- timer1.Stop();
- /* y = zufallyo.Next(0, 565);
- x = zufallyo.Next(0, 565);
- y2 = pictureBox1.Top;
- x2 = pictureBox1.Left;
- */
- y = 200;
- x = 200;
- y2 = 600;
- x2 = 400;
- m = (y2 - y) / (x2 - x);
- b = (y2 - m * x2);
- /*
- ArrayList Marr = new ArrayList();
- Marr = func(x, y, x2, y2);
- double abziehen = Math.Round((m * x + b));
- for (int i = 0; i <= Marr.Count - 1; i++)
- {
- MessageBox.Show(Marr[i].ToString());
- }
- label1.Text = Marr.ToString();*/
- }
- /* static double Berechnen(double x, double y )
- {
- Random zufallyo = new Random();
- y = zufallyo.Next(0, 565);
- x = zufallyo.Next(0, 565);
- y2 = pictureBox1.Top;
- x2 = pictureBox1.Left;
- m = (y2 - y) / (x2 - x);
- b = (y2 - m * x2);
- // pictureBox1.Left += 1;
- double abziehen = Math.Round((m * 205 + b) - y);
- }
- * */
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement