Note that there are some explanatory texts on larger screens.

plurals
  1. POBoard Game, Token Movement C#
    primarykey
    data
    text
    <p>will someone help me in this moving of my token, which is found in the diceroll() method, if the user clicks the dice roll button, the token will round the board. the problem is the token is going outside the board </p> <p>i already set a the first value of x as 15 and y as 12 (if you want to see the whole game file: <a href="http://www.mediafire.com/?1rz1689di15o8sq" rel="nofollow">http://www.mediafire.com/?1rz1689di15o8sq</a>)</p> <pre><code>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; namespace GAME { public partial class GameInterface : Form { int curx, cury, tempx, tempy; private int x, y; public int Seconds; public int minutes = 5; Int32 dice; public GameInterface() { InitializeComponent(); } private void button1_Click(object sender, EventArgs e) { token.Location = new Point(15, 12); x = 15; y = 12; button1.Enabled = false; } private void Quit_Click(object sender, EventArgs e) { quitting quit = new quitting(); quit.ShowDialog(); } private void Dice_Click(object sender, EventArgs e) { diceroll(); timer1.Enabled = true; } public void coorx(int x) { curx = x; } public void coory(int y) { cury = y; } public int getx() { return curx; } public int gety() { return cury; } public void diceroll() { System.Random diceroll = new Random(); dice = diceroll.Next(6) + 1; DiceBox.Text = Convert.ToString(dice); if (x &gt;= 15 &amp;&amp; y &lt;= 102) { x = getx(); tempx = x + (105 * dice); token.Location = new Point(tempx, y); coorx(tempx); } if (x &gt;= 608 &amp;&amp; y &lt;= 12) { y = gety(); int tempy = y + (95 * dice); token.Location = new Point(x, tempy); coory(tempy); } if (x &gt;= 707 &amp;&amp; y &lt;= 552) { x = getx(); tempx = x - (105 * dice); token.Location = new Point(tempx, y); coorx(tempx); } if (x &gt;= 113 &amp;&amp; y &lt;= 642) { y = gety(); int tempy = y - (95 * dice); token.Location = new Point(x, tempy); coory(tempy); } } private void timer1_Tick(object sender, EventArgs e) { if ((minutes == 0) &amp;&amp; (Seconds == 0)) { timer1.Enabled = false; MessageBox.Show("Game Over!"); label3.Text = "05"; label5.Text = "00"; } else { if (Seconds &lt; 1) { Seconds = 60; timer1.Interval = 1000; if (minutes != 0) minutes -= 1; } else { Seconds -= 1; label3.Text = minutes.ToString(); label5.Text = Seconds.ToString(); } } } private void GameInterface_Load(object sender, EventArgs e) { } } } </code></pre>
    singulars
    1. This table or related slice is empty.
    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