Exemplo n.º 1
0
void initData(void) {
	/* lasttime = SystemGetElapsedTime(); */
	game->pauseflag = PAUSE_GAME_RUNNING;

	game2->rules.speed = getSettingf("speed");
	game2->rules.eraseCrashed = getSettingi("erase_crashed");
	game2->rules.grid_size = getSettingi("grid_size");

	game2->grid.width = game2->rules.grid_size;
	game2->grid.height = game2->rules.grid_size;

	/* time management */
	game2->time.lastFrame = 0;
	game2->time.current = 0;
	game2->time.offset = SystemGetElapsedTime();
	/* TODO: fix that */
	game2->players = game->players;
	/* event management */
	game2->events.next = NULL;
	/* TODO: free any old events that might have gotten left */

  resetVideoData();
	resetPlayerData();

  initWalls();
}
Exemplo n.º 2
0
void Model::startGame() {
    idGameTimer = 0;
    gameStatus = STOPPED;
    presentVector = Qt::Key_Right;
    previousVector = Qt::Key_Right;
    haveMooved = false;

    bonusTiks = 0;
    isBonusVisible = false;
    bonusVisibleTimeLeft = 20;

    snakeSpeed = NORMAL_SNAKE_SPEED;

    score = 0;
    bonusAte = 0;
    ate = 0;
    life = 1;

    initWalls();
    initSnake();


    addGameElement(FOOD);


    gameTimer.start(snakeSpeed, this);
    idGameTimer = gameTimer.timerId();

    gameStatus = STARTED;
}
Exemplo n.º 3
0
worldRenderer::worldRenderer(maze *m) : m(m), bridge(m) {
	pillarBox.setSize(pillarSize, pillarHeight, pillarSize, pillarHeight);
    groundBox.setSize(tileSize, blockHeight * 2.f, tileSize, tileSize);
    wallBox.setSize(tileSize - wallThickness, wallHeight, wallThickness, tileSize * 0.5f);
    startBox.setSize(startBoxSize, startBoxHeight, startBoxSize, startBoxSize);
    endBox.setSize(startBoxSize, startBoxHeight, startBoxSize, startBoxSize);
    arrowBox.setSize(startBoxSize, startBoxHeight, startBoxSize, startBoxSize);
    marble.setSize(marbleRadius, 16, 16);

	width = m->width();
	height = m->height();

	initPillars();
	initGround();
	initWalls();
	initItems();
}