public Vector2D Subtract(Vector2D vec) { Vector2D newVec = new Vector2D(x, y); newVec.X = vec.X - this.x; newVec.Y = vec.Y - this.y; return newVec; }
//The constructor. This also creates the string, which make the worker travel between the inn and the farm. public Worker(float speed, string imagepath, Vector2D startPos, float scalefactor) : base(imagepath, startPos, scalefactor) { this.speed = speed; Thread t = new Thread(() => Update(GameWorld.currentFps)); t.IsBackground = true; t.Start(); }
//The base constructor. public GameObject(string imagePath, Vector2D startPos, float scaleFactor) { position = startPos; this.scaleFactor = scaleFactor; this.imagePath = imagePath; this.sprite = Image.FromFile(imagePath); }
public Farm(string imagepath, Vector2D startpos, float scalefactor) : base(imagepath, startpos, scalefactor) { base.position = startpos; }