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); }
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); }
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; }
private void initiate() { moveX = 1; moveY = 0; frameTimer = new Stopwatch(); gameController = new GameController(); gameInfoDTO = gameController.initiate(INITIALSNAKESIZE, Console.WindowWidth, Console.WindowHeight); frameTimer = new Stopwatch(); }
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; }
public GameInfoDTO initiate(int snakeSize, int screenWidth, int screenHeight) { GameInfoDTO returnInfo = implementedLogic.initiate(snakeSize, screenWidth, screenHeight); return(returnInfo); }