private void mapBox_Paint(object sender, PaintEventArgs e) { g = e.Graphics; if (mouse == null) { mouse = new MouseController(g, cellSize, myMap, this, cat); } else { mouse.DrawMouse(g); } if (cat == null) { cat = new CatController(g, cellSize, myMap, this, mouse); } else { cat.DrawCat(g); } // draw the paving slabs foreach (Cell myCell in myMap) { myCell.drawBackground(g); } mouse.Cat = cat; su = new ScoreInfoEventArgs(); mouse.ScoreChange += new ScoreChangeEventHandler(ChangeScore); gameRunning = true; }
protected virtual void ChangeScore(object sender, ScoreInfoEventArgs e) { Control[] scoreBox = Controls.Find("scoreBox", false); scoreBox[0].Text = e.score.ToString(); }