Exemple #1
0
        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();
        }
Exemple #2
0
        public Start()
        {
            InitializeComponent();

            if (INPUTS.KeyPressed(Keys.Enter))
            {
            }
        }
Exemple #3
0
 private void Form1_KeyUp(object sender, KeyEventArgs e)
 {
     INPUTS.ChangeState(e.KeyCode, false);
 }
Exemple #4
0
 private void Form1_KeyDown(object sender, KeyEventArgs e)
 {
     INPUTS.ChangeState(e.KeyCode, true);
 }