hi,
im havin problems creating a class for first time. The programm is about a dog race, so if you need more explanaitions tell me please.
Here is my class:
class Dog
{
public int RaceLenght =20;
public int StartPosition = 0;
public PictureBox IMG;
public int Position;
public Random Rnd;
public bool Run(bool status)
{
return status;
}
public void reset()
{
Position = StartPosition;
}
}
Here is my form:
string[]Arr = new string[4];
Dog Dog1 = new Dog();
Dog Dog2 = new Dog();
Dog Dog3 = new Dog();
Dog Dog4 = new Dog();
int distanz1;
int distanz2;
int distanz3;
int distanz4;
Run Button:
Dog1.Run(true)
Dog1.IMG = picturebox1;
Point p = picturebox1.Location;
distanz1 = Dog1.Rnd.Next(1,4);
p.X += distanz1;
Img.Location = p;
now i would do this for every object, what stands in the button, for dog2,3 and 4.
i think my code isnt the very best..