Esempio n. 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);
        }
Esempio n. 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);
 }
Esempio n. 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;
 }
Esempio n. 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();
 }
Esempio n. 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();
 }
Esempio n. 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;
        }
Esempio n. 7
0
        public GameInfoDTO initiate(int snakeSize, int screenWidth, int screenHeight)
        {
            GameInfoDTO returnInfo = implementedLogic.initiate(snakeSize, screenWidth, screenHeight);

            return(returnInfo);
        }