예제 #1
0
void HelloWorld::startGame(){
    linesCount = 0;
    showEnd = false;
    timerRunning = false;
    
    addStartLine();
    addNormalLine(1);
    addNormalLine(2);
    addNormalLine(3);
}
void HelloWorld::moveDown(){
    
    if (linesCount<50) {
        addNormalLine(4);
    }else if(!showEnd){
        addEndLine();
        showEnd = true;
    }
    
    
    auto bs = Block::getBlocks();
    
    for (auto it = bs->begin(); it!=bs->end(); it++) {
        (*it)->moveDown();
    }
    
    if (currentEndLine!=NULL) {
        
        if (currentEndLine->getLineIndex()==1) {
            //Game end
            moveDown();
            stopTimer();
        }
    }
}
void HelloWorld::startGame(){
    //init
    stopTimer();
    linesCount = 0;
    showEnd = false;
    timerRunning = false;
    currentEndLine = NULL;
    timerLabel->setString("0.000000");
    
    //try to clear
    Block::removeAllBlocks();
    
    addStartLine();
    addNormalLine(1);
    addNormalLine(2);
    addNormalLine(3);
}
예제 #4
0
void HelloWorld::moveDown(){
    
    if (linesCount<50) {
        addNormalLine(4);
    }else if(!showEnd){
        addEndLine();
        showEnd = true;
    }
    
    
    auto bs = Block::getBlocks();
    
    for (auto it = bs->begin(); it!=bs->end(); it++) {
        (*it)->moveDown();
    }
}