private void ViewScoreScreen_PreviewKeyDown(object sender, PreviewKeyDownEventArgs e) { if (top5) { if (e.KeyCode == Keys.Right && selectIndex == 0) { selectIndex++; } else if (e.KeyCode == Keys.Left && selectIndex == 1) { selectIndex--; } Refresh(); } if (e.KeyCode == Keys.Space) { if (selectIndex == 0) { Form f = this.FindForm(); f.Controls.Remove(this); MenuScreen ms = new MenuScreen(); f.Controls.Add(ms); Form1.top5Name = false; } else { Form f = this.FindForm(); f.Controls.Remove(this); NameScreen ns = new NameScreen(); f.Controls.Add(ns); Form1.top5Name = true; } } }
private void StartScreen_PreviewKeyDown(object sender, PreviewKeyDownEventArgs e) { if (chooseName) { if (e.KeyCode == Keys.Down) { if (nameIndex != 3) { nameIndex++; } } else if (e.KeyCode == Keys.Up) { if (nameIndex != 0) { nameIndex--; } } else if (e.KeyCode == Keys.Space) { switch (nameIndex) { case 0: if (player == "RED") { Form1.gameName = true; } else { Form1.rName = true; } Form f = this.FindForm(); NameScreen ns = new NameScreen(); f.Controls.Remove(this); f.Controls.Add(ns); break; case 1: if (player == "RED") { Form1.playerName = "RED"; messageLines[20] = "name is RED!"; messageLines[30] = "RED!"; } else { Form1.rivalName = "BLUE"; messageLines[29] = "name is BLUE!"; } break; case 2: if (player == "RED") { Form1.playerName = "ASH"; messageLines[20] = "name is ASH!"; messageLines[30] = "ASH!"; } else { Form1.rivalName = "GARY"; messageLines[29] = "name is GARY!"; } break; case 3: if (player == "RED") { Form1.playerName = "JACK"; messageLines[20] = "name is JACK!"; messageLines[30] = "JACK!"; } else { Form1.rivalName = "JOHN"; messageLines[29] = "name is JOHN!"; } break; } SlideBack(); } Refresh(); } else { if (e.KeyCode == Keys.Space) { if (Form1.messageIndex == 36) { gameTimer.Stop(); Thread.Sleep(500); slideIndex = 4; spriteLocation.X = this.Width / 2 - spriteDimensions[slideIndex].Width / 2 + slide; spriteLocation.Y = y1 - spriteDimensions[slideIndex].Height - 50; Refresh(); Thread.Sleep(500); slideIndex++; spriteLocation.X = this.Width / 2 - spriteDimensions[slideIndex].Width / 2 + slide; spriteLocation.Y = y1 - spriteDimensions[slideIndex].Height - 70; Refresh(); Thread.Sleep(500); Form f = this.FindForm(); f.Controls.Remove(this); GameScreen gs = new GameScreen(); f.Controls.Add(gs); f.Height -= 33; } else if (Form1.messageIndex == 4) { SlideLeft(); } else if (Form1.messageIndex == 15) { SlideLeft(); } else if (Form1.messageIndex == 17) { SlideRight(); player = "RED"; } else if (Form1.messageIndex == 20) { slideIndex++; Form1.messageIndex++; spriteLocation.X = this.Width / 2 - spriteDimensions[slideIndex].Width / 2 + slide; spriteLocation.Y = y1 - spriteDimensions[slideIndex].Height - 20; Refresh(); } else if (Form1.messageIndex == 25) { SlideRight(); player = "BLUE"; } else if (Form1.messageIndex == 28) { slideIndex = 2; spriteLocation.X = this.Width / 2 - spriteDimensions[slideIndex].Width / 2 + slide; spriteLocation.Y = y1 - spriteDimensions[slideIndex].Height - 20; Form1.messageIndex += 2; Refresh(); } else { SlideText(); } } } }