private void UpdateScreen(object sender, EventArgs e) { //Check for Game Over if (Settings.GameOver) { //Check if Enter is pressed if (INPUTS.KeyPressed(Keys.Enter)) { StartGame(); } } else { if (INPUTS.KeyPressed(Keys.Right) && Settings.direction != Direction.Left) { Settings.direction = Direction.Right; } else if (INPUTS.KeyPressed(Keys.Left) && Settings.direction != Direction.Right) { Settings.direction = Direction.Left; } else if (INPUTS.KeyPressed(Keys.Up) && Settings.direction != Direction.Down) { Settings.direction = Direction.Up; } else if (INPUTS.KeyPressed(Keys.Down) && Settings.direction != Direction.Up) { Settings.direction = Direction.Down; } MovePlayer(); } PBcanvas.Invalidate(); }
public Start() { InitializeComponent(); if (INPUTS.KeyPressed(Keys.Enter)) { } }
private void Form1_KeyUp(object sender, KeyEventArgs e) { INPUTS.ChangeState(e.KeyCode, false); }
private void Form1_KeyDown(object sender, KeyEventArgs e) { INPUTS.ChangeState(e.KeyCode, true); }