Note that there are some explanatory texts on larger screens.

plurals
  1. POCannot get the counters to move (game in C# with PictureBox).
    primarykey
    data
    text
    <p>I'm trying to learn C# (so go easy on me!) and as part of a coursework I have been asked to create a game called strikeout. </p> <p>The game rules are very simple. It is simply a case of knocking one counter into another, with the aim of leaving one counter left on the screen. </p> <p>I am having trouble simply moving one counter into another. I have created a number of picture boxes using a loop (to make up my board), and created an event handler using the loop. How can I use the single even handler to move all of my counters? </p> <pre><code>{ (...) for (int i = 0; i &lt; 8; i++) { for (int j = 0; j &lt; 8; j++) { int x = j * (75); int y = i * (75); pictureBoxCounter[j, i] = new PictureBox(); pictureBoxCounter[j, i].Location = new System.Drawing.Point(x, y); pictureBoxCounter[j, i].Size = new System.Drawing.Size(75, 75); pictureBoxCounter[j, i].BackColor = System.Drawing.Color.Transparent; panelGame.Controls.Add(pictureBoxCounter[j, i]); this.pictureBoxCounter[j, i].Click += new System.EventHandler(this.pictureBoxCounter_Click); } } } // end of some function private void pictureBoxCounter_Click(object sender, EventArgs e) { //I need some code here but nothing seems to work :( } </code></pre> <p>I've spent way to long on this problem. Even asked my tutor to help. Instead of helping he managed to break most of my code. So after fixing the problems he caused I am now back with a compiling program!</p> <p>(When running the program you will need to enter player info to enable the start game button.)</p> <p>If I can help with any other information don't hesitate to ask!</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload