public static DialogResult Show() { shopForm = new ShopMenu(); shopForm.StartPosition = FormStartPosition.CenterParent; shopForm.ShowDialog(); return(buttonResult); }
private void gameTimer_Tick(object sender, EventArgs e) { #region updating nori movement //setting the rectangles to the updated x,y noriRec = new Rectangle(nori.x + (nori.size / 4), nori.y + (nori.size / 8) * 7, (nori.size / 2), nori.size / 8); if (wDown == true && nori.y >= (boothWidth / 4) * 5 - nori.size) { nori.MoveUpDown(-HEROSPEED); direction = "up"; animationCounterH++; spriteNumber = 0; NoriAnimation(); } if (sDown == true && wDown == false && nori.y <= this.Height - (this.Height / 57) * 10 - nori.size) { nori.MoveUpDown(HEROSPEED); direction = "down"; animationCounterH++; spriteNumber = 3; NoriAnimation(); } if (dDown == true && aDown == false && nori.x <= this.Width - BORDERWIDTH - 100) { nori.MoveLeftRight(HEROSPEED); direction = "right"; animationCounterH++; spriteNumber = 6; NoriAnimation(); } if (aDown == true && dDown == false && nori.x >= BORDERWIDTH + (boothHeight / 5) * 4 - 20) { nori.MoveLeftRight(-HEROSPEED); direction = "left"; animationCounterH++; spriteNumber = 9; NoriAnimation(); } #endregion #region collisions if (noriRec.IntersectsWith(objectRecs[0])) { if (direction == "down") { sDown = false; } if (direction == "up") { sDown = false; } if (direction == "left") { dDown = false; } if (direction == "right") { dDown = false; } } //interacting with arlo and bringing up shop menu if (noriRec.IntersectsWith(objectRecs[0]) && spaceDown == true) { //play interaction sound interactionSound.Play(); if (gameTimer.Enabled == true) { wDown = aDown = sDown = dDown = spaceDown = false; gameTimer.Enabled = false; ShopMenu shopForm = new ShopMenu(); DialogResult dr = ShopMenu.Show(); if (dr == DialogResult.Cancel) { gameTimer.Enabled = true; } else if (dr == DialogResult.Abort) { Form form = this.FindForm(); MenuScreen ms = new MenuScreen(); ms.Location = new Point((form.Width - ms.Width) / 2, (form.Height - ms.Height) / 2); form.Controls.Add(ms); form.Controls.Remove(this); } } } if (noriRec.IntersectsWith(objectRecs[1]) && spaceDown == true) { //play interaction sound interactionSound.Play(); gameTimer.Enabled = false; Form form = this.FindForm(); form.Controls.Remove(this); } #endregion Refresh(); }