diff options
| author | lempamo <[email protected]> | 2017-03-02 10:36:34 -0500 |
|---|---|---|
| committer | lempamo <[email protected]> | 2017-03-02 10:52:23 -0500 |
| commit | 9b138708b979ca70730a34b56baa47b22299eb92 (patch) | |
| tree | a19e51f2f028647b74c5802e3c7fe661d85ba3a5 | |
| parent | 6fa7a0837381e92ecca62faa19708b4d8a1e1515 (diff) | |
| download | shiftos_thereturn-9b138708b979ca70730a34b56baa47b22299eb92.tar.gz shiftos_thereturn-9b138708b979ca70730a34b56baa47b22299eb92.tar.bz2 shiftos_thereturn-9b138708b979ca70730a34b56baa47b22299eb92.zip | |
tail bug fixed, but now a crash happens
| -rw-r--r-- | ShiftOS.WinForms/Applications/Snakey.cs | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/ShiftOS.WinForms/Applications/Snakey.cs b/ShiftOS.WinForms/Applications/Snakey.cs index 65cf829..f3b52fe 100644 --- a/ShiftOS.WinForms/Applications/Snakey.cs +++ b/ShiftOS.WinForms/Applications/Snakey.cs @@ -117,8 +117,10 @@ namespace ShiftOS.WinForms.Applications if (!extending) { tail.Image = Properties.Resources.SnakeyBG; //mikey its here - tail.Refresh(); + snakemap[tailX, tailY] = 0; + tableLayoutPanel1.Refresh(); snakepartlist[newHeadX, newHeadY] = snakelength; + bool[,] exemptlist = new bool[10, 10]; bool splassigned = false; for (int s = snakelength; s > 0; s--) { @@ -129,10 +131,12 @@ namespace ShiftOS.WinForms.Applications for (int y = 0; y < 10; y++) { if (splassigned) break; + if (exemptlist[x, y]) continue; if (x == newHeadX && y == newHeadY) continue; if (snakepartlist[x, y] == snakelength) { snakepartlist[x, y]--; + exemptlist[x, y] = true; splassigned = true; break; } @@ -183,6 +187,7 @@ namespace ShiftOS.WinForms.Applications break; } ((PictureBox)tableLayoutPanel1.GetControlFromPosition(newTailX, newTailY)).Image = tailImg; + snakemap[newTailX, newTailY] = 3; } if (extending) { @@ -346,10 +351,10 @@ namespace ShiftOS.WinForms.Applications } } } - if (tail.BackgroundImage == Properties.Resources.SnakeyTailL) return 0; - if (tail.BackgroundImage == Properties.Resources.SnakeyTailD) return 1; - if (tail.BackgroundImage == Properties.Resources.SnakeyTailR) return 2; - if (tail.BackgroundImage == Properties.Resources.SnakeyTailU) return 3; + if (tail.Image == Properties.Resources.SnakeyTailL) return 0; + if (tail.Image == Properties.Resources.SnakeyTailD) return 1; + if (tail.Image == Properties.Resources.SnakeyTailR) return 2; + if (tail.Image == Properties.Resources.SnakeyTailU) return 3; return -1; } |
