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

            if (INPUTS.KeyPressed(Keys.Enter))
            {
            }
        }