示例#1
0
void BlockDown::logic(){
  //  int dotHeight = dot->y + dot->DOT_HEIGHT;
        this->time++;

        int collision = collisionType();
        if(!wasColliding){
        switch(collision){
        case 0:
        break;

        case TOP:
                dot->angle = -dot->angle;
                dot->angle += rand()%10 - 20;
                this->life--;
            break;
        case BOT:
            dot->angle = -dot->angle;
            dot->angle += rand()%10 - 20;
            this->life--;
            break;

        case RIGHT: case LEFT:
            dot->angle = -dot->angle+180;
            dot->angle += rand()%10 - 20;
            this->life--;
            break;
         case CORNERUL:
             dot->velocity = abs(dot->velocity);
             dot->angle = 315;
             dot->angle += rand()%5-10;
             this->life--;
             break;
        case CORNERUR:
            dot->velocity = abs(dot->velocity);
             dot->angle = 225;
             dot->angle += rand()%5-10;
             this->life--;
             break;
        case CORNERDR:
            dot->velocity = abs(dot->velocity);
             dot->angle = 135;
             dot->angle += rand()%5-10;
             this->life--;
             break;
        case CORNERDL:
            dot->velocity = abs(dot->velocity);
             dot->angle = 45;
             dot->angle += rand()%5-10;
             this->life--;
        }

         if(this->life<=0){
            activado=true;
            refBlocks();

        }

        }

}
示例#2
0
文件: block.cpp 项目: Immac/Semana5
void Block::logic(){
  //  int dotHeight = dot->y + dot->DOT_HEIGHT;

this->current_frame++;




        int collision = collisionType();
        if(!wasColliding){
        switch(collision){
        case 0:
        break;

        case TOP:
                dot->angle = -dot->angle;
                dot->angle += rand()%10 - 20;

                this->takeDamage();
            break;
        case BOT:
            dot->angle = -dot->angle;
            dot->angle += rand()%10 - 20;
            this->takeDamage();
            break;

        case RIGHT: case LEFT:
            dot->angle = -dot->angle+180;
            dot->angle += rand()%10 - 20;
            this->takeDamage();
            break;
         case CORNERUL:
             dot->velocity = abs(dot->velocity);
             dot->angle = 315;
             dot->angle += rand()%5-10;
             this->takeDamage();
             break;
        case CORNERUR:
            dot->velocity = abs(dot->velocity);
             dot->angle = 225;
             dot->angle += rand()%5-10;
             this->takeDamage();
             break;
        case CORNERDR:
            dot->velocity = abs(dot->velocity);
             dot->angle = 135;
             dot->angle += rand()%5-10;
             this->takeDamage();
             break;
        case CORNERDL:
            dot->velocity = abs(dot->velocity);
             dot->angle = 45;
             dot->angle += rand()%5-10;
             this->takeDamage();
        }

        }
 dot->angle = toUsableAngle(dot->angle);
}
示例#3
0
void Player::logic(){

  //  int dotHeight = dot->y + dot->DOT_HEIGHT;
        int collision = collisionType();
        if(!wasColliding){
        switch(collision){
        case 0:
        break;

        case TOP2:
                dot->angle = -dot->angle;
                dot->angle += rand()%10 - 20;

            break;
        case BOT2:
            dot->angle = -dot->angle;
            dot->angle += rand()%10 - 20;

            break;

        case RIGHT2: case LEFT2:
            dot->angle = -dot->angle+180;
            dot->angle += rand()%10 - 20;
            break;
         case CORNERUL2:
             dot->velocity = abs(dot->velocity);
             dot->angle = 315;
             dot->angle += rand()%5-10;
             break;
        case CORNERUR2:
            dot->velocity = abs(dot->velocity);
             dot->angle = 225;
             dot->angle += rand()%5-10;
             break;
        case CORNERDR2:
            dot->velocity = abs(dot->velocity);
             dot->angle = 135;
             dot->angle += rand()%5-10;
             break;
        case CORNERDL2:
            dot->velocity = abs(dot->velocity);
             dot->angle = 45;
             dot->angle += rand()%5-10;
             }

        }

}
示例#4
0
void ghostBlock::logic(){
  //  int dotHeight = dot->y + dot->DOT_HEIGHT;


        int collision = collisionType();
        if(!wasColliding){
        switch(collision){
        case 0:
        break;

        case TOP:
                dot->angle = -dot->angle;
                dot->angle += rand()%10 - 20;

                   do{
             this->time=60;
             dot->ghostDot();
             this->time++;
        }while (this->time==600);
                this->time=0;

                this->life--;
            break;
        case BOT:
            dot->angle = -dot->angle;
            dot->angle += rand()%10 - 20;

               do{
             this->time=60;
             dot->ghostDot();
             this->time++;
        }while (this->time==600);
                this->time=0;

            this->life--;
            break;

        case RIGHT: case LEFT:
            dot->angle = -dot->angle+180;
            dot->angle += rand()%10 - 20;

               do{
             this->time=60;
             dot->ghostDot();
             this->time++;
        }while (this->time==600);
                this->time=0;

            this->life--;
            break;
         case CORNERUL:
             dot->velocity = abs(dot->velocity);
             dot->angle = 315;
             dot->angle += rand()%5-10;

                do{
             this->time=60;
             dot->ghostDot();
             this->time++;
        }while (this->time==600);
                this->time=0;

             this->life--;
             break;
        case CORNERUR:
            dot->velocity = abs(dot->velocity);
             dot->angle = 225;
             dot->angle += rand()%5-10;

                do{
             this->time=60;
             dot->ghostDot();
             this->time++;
        }while (this->time==600);
                this->time=0;

             this->life--;
             break;
        case CORNERDR:
            dot->velocity = abs(dot->velocity);
             dot->angle = 135;
             dot->angle += rand()%5-10;

                do{
             this->time=60;
             dot->ghostDot();
             this->time++;
        }while (this->time==600);
                this->time=0;

             this->life--;
             break;
        case CORNERDL:
            dot->velocity = abs(dot->velocity);
             dot->angle = 45;
             dot->angle += rand()%5-10;

                do{
             this->time=60;
             dot->ghostDot();
             this->time++;
        }while (this->time==600);
                this->time=0;

             this->life--;
        }


        }

}