Example #1
0
        private int rungame()
        {
            while (!gameInfoDTO.gameOver)
            {
                pause(FRAMERATE);
                //Control framerate by pausing a given number of milliseconds
                //get key input
                if (Console.KeyAvailable)
                {
                    inputHandler();
                }
                if (!(moveX == 0))
                {
                    gameInfoDTO = gameController.HorizontalMovement(moveX);
                }
                else
                {
                    gameInfoDTO = gameController.VerticalMovement(moveY);
                }

                drawApple();
                drawSnake();
            }
            return(1);
        }
Example #2
0
 public GameInfoDTO initiate(int snakeSize, int inScrnWidth, int inScrnHeight)
 {
     screenWidth  = inScrnWidth;
     screenHeight = inScrnHeight;
     snake        = new Snake(snakeSize);
     setApplePos();
     gameInfo = new GameInfoDTO(snake.getSnake(), apple);
     return(gameInfo);
 }
Example #3
0
 public GameInfoDTO initiate(int snakeSize, int inScrnWidth, int inScrnHeight)
 {
     screenWidth = inScrnWidth;
     screenHeight = inScrnHeight;
     snake = new Snake(snakeSize);
     setApplePos();
     gameInfo = new GameInfoDTO(snake.getSnake(), apple);
     return gameInfo;
 }
Example #4
0
 private void initiate()
 {
     moveX          = 1;
     moveY          = 0;
     frameTimer     = new Stopwatch();
     gameController = new GameController();
     gameInfoDTO    = gameController.initiate(INITIALSNAKESIZE, Console.WindowWidth, Console.WindowHeight);
     frameTimer     = new Stopwatch();
 }
Example #5
0
 private void initiate()
 {
     moveX = 1;
     moveY = 0;
     frameTimer = new Stopwatch();
     gameController = new GameController();
     gameInfoDTO = gameController.initiate(INITIALSNAKESIZE, Console.WindowWidth, Console.WindowHeight);
     frameTimer = new Stopwatch();
 }
Example #6
0
        private int rungame()
        {
            while (!gameInfoDTO.gameOver)
            {
                pause(FRAMERATE);
                //Control framerate by pausing a given number of milliseconds
                //get key input
                if (Console.KeyAvailable)
                {
                    inputHandler();
                }
                if (!(moveX == 0))
                {
                    gameInfoDTO = gameController.HorizontalMovement(moveX);
                }
                else
                {
                    gameInfoDTO = gameController.VerticalMovement(moveY);
                }

                drawApple();
                drawSnake();
            }
            return 1;
        }
Example #7
0
        public GameInfoDTO initiate(int snakeSize, int screenWidth, int screenHeight)
        {
            GameInfoDTO returnInfo = implementedLogic.initiate(snakeSize, screenWidth, screenHeight);

            return(returnInfo);
        }