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

            return(returnInfo);
        }