void insertExplosion(){ for(int i=0;i<NUM_ENEMY;i++){ if(explosionEnemy[i].active) { drawExplosion(&explosionEnemy[i]); } // questo if e' per non fare un altro ciclo for // poiche' NUM_POLICE<NUM_ENEMY usiamo lo stesso ciclo e se l'indice // e' utilizzabile anche per il vettore della polizia, lo usiamo if(i<NUM_POLICE && explosionPolice[i].active) { drawExplosion(&explosionPolice[i]); } } }
void Livininabox(){ double time; time = getTimeInterval(); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); if(time > 0.0 && time < 16.17) KnockKnock(time); if(time > 16.04 && time < 27.07) drawExplosion(time - 16.04); if(time > 16.17 && time < 27.07) JumpOut(time - 16.17); if(time > 27.07 && time < 52.23) RunForLife(time - 27.07); if(time > 52.23 && time < 66.50) Credits(time); if(time > 66.50 && time < 118.06) Greetings(time - 66.50); if(time > 118.06 && time < 134.00) ProceduralScenes(time - 118.06); if(time > 134.00 && time < 162.94) FractalMe(time - 134.00); if(time > 162.94 && time < 196.94) CubeTunnel(time - 162.94); if(time > 196.94 && time < 221.26) Trap(time - 196.94); if(time > 221.26 && time < 226.86) HangingFruite(time - 221.26); if(time > 226.86 && time < 248.49) WatchOutForTheLetters(time - 226.86); if(time > 248.49 && time < 271.87) OpenTheDoor(time - 248.49); if(time > 271.87 && time < 276.85) Headbreak(time); if(time > 276.85 && time < 283.33) Matatas(time); if(time > 283.33 && time < 300.00) Cube(time - 283.33); if(time > 300.00 && time < 307.00) End(); if(time > 307.00) cg_isrunning = 0; }
void drawAllCollisions() { // No explosions in the outer 5% of the strip, they tend to last too long for (uint16_t i = NUM_LEDS/20; i<NUM_LEDS-NUM_LEDS/20; i++) { if (checkForCollision(i)) { drawExplosion(i); } } }
void drawEnemySet(LEVEL level) { unsigned int i = 0; for (i = 0; i < level.enemyNumber; i++) { if ((level.enemyset+i)->visible) { drawObject(level.enemyset+i); } else if ((level.enemyset+i)->explosion_delay) { drawExplosion(level.enemyset+i); } } }
void drawImpact(PlayerVisual *pV) { glDisable(GL_LIGHTING); glPushMatrix(); glRotatef(90, 90, 0, 1); /* * Drop impact slightly below the floor and move it a tiny bit * back from the impact point so we don't draw behind the * trail/wall that's hit. */ glTranslatef(0.0, -0.5, -0.5); glColor3f(0.68f, 0, 0); drawExplosion(&(pV->impact_radius)); glPopMatrix(); glEnable(GL_LIGHTING); }
void Ball::drawGameBall() const { activateBallShader(); { //glPushMatrix(); { //glTranslatef(mPos.x, mPos.y, mPos.z); //glScalef(mRadius, mRadius, mRadius); quaternionTransform(mOrientation); /* explosion? */ if (mIsBallInPieces) { drawExplosion(); } else { drawBall(); } } //glPopMatrix(); } deactivateBallShader(); }
int main(void){ int i = 0; //Score set score = 0; PLL_Init(); //Sound init DAC_Init(); Timer0A_Init(Sound_Update, 1000000/11025); // Timer0B_Init(updateXAxis, 1000000/11025); // Timer1B_Init(updateYAxis, 1000000/11025); //Input ADC_Init(); portD_Init(); SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOG); GPIOPinTypeGPIOInput(GPIO_PORTG_BASE, (GPIO_PIN_3 | GPIO_PIN_4 | GPIO_PIN_5 | GPIO_PIN_6 | GPIO_PIN_7)); GPIOPinTypeGPIOOutput(GPIO_PORTG_BASE, GPIO_PIN_2); GPIOPadConfigSet(GPIO_PORTG_BASE, (GPIO_PIN_3 | GPIO_PIN_4 | GPIO_PIN_5 | GPIO_PIN_6 | GPIO_PIN_7), GPIO_STRENGTH_2MA, GPIO_PIN_TYPE_STD_WPU); SysTick_Init(50000000/400); Output_Init(); Output_Color(15); SysTick_IntEnable(); EnableInterrupts(); //Set flags gFlags = 0; HWREGBITW(&gFlags, TITLE_SCREEN) = True; //Math rand set seed while(HWREGBITW(&gFlags, SELECT_DOWN) == 0 && ((GPIO_PORTG_DATA_R & 0x80) != 0)) { } while(HWREGBITW(&gFlags, SELECT_DOWN) == 1 || ((GPIO_PORTG_DATA_R & 0x80) == 0)) { } setSeed(NVIC_ST_CURRENT_R); //Game set setGraphics(1);//the lm3s can't handle more than 2 rocks at graphics level 3. gameInit(); gameSet(0); while(1) { //Only draw to buffer when it has been output to the screen if(HWREGBITW(&gFlags, FRAME_BUFFER_READY) == False) { /*if(gameLevel == -2) { drawString(myMsgs[1], makePoint(50, 40)); while ((GPIO_PORTG_DATA_R & 0x80) != 0 && HWREGBITW(&gFlags, SELECT_DOWN) == False) { } while ((GPIO_PORTG_DATA_R & 0x80) == 0 && HWREGBITW(&gFlags, SELECT_DOWN) == True) { } //Reset game */ //Check for level completion, aka all rocks and enemies are //TODO: enemies if(HWREGBITW(&gFlags, LEVEL_COMPLETE) == True) { gameSet(++gameLevel); } //Redraw the screen from scratch. clearBuffer(); //Draw the player. if(gPlayer.status == ALIVE) { drawPlayer(makePoint((int)gPlayer.x, (int)gPlayer.y), gPlayer.angle, gPlayer.exhaustOn); } for(i = 0; i < MAX_ROCKS; i++) { if(gRocks[i].status == ALIVE) { drawRock(makePoint(gRocks[i].x, gRocks[i].y), gRocks[i].rockType, gRocks[i].rockSize); } } //Draw allied bullets. for(i = 0; i < MAX_PLAYER_BULLETS; i++) { if(gPlayerBullets[i].status == ALIVE) { drawBullet(makePoint(gPlayerBullets[i].x, gPlayerBullets[i].y)); } } //Draw enemy bullets. for(i = 0; i < MAX_ENEMY_BULLETS; i++) { if(gEnemyBullets[i].status == ALIVE) { drawBullet(makePoint(gEnemyBullets[i].x, gEnemyBullets[i].y)); } } //Draw explosions. for(i = 0; i < MAX_EXPLOSIONS; i++) { if(gExplosions[i].status == ALIVE) { drawExplosion(gExplosions[i].pos, gExplosions[i].current); } } // drawNumber(score, makePoint(2,2)); drawNumber(gameLevel, makePoint(128/2-6,2)); if(HWREGBITW(&gFlags, GAME_OVER) == True) { drawString("GAME OVER", makePoint(40, 38)); if((GPIO_PORTG_DATA_R & 0x80)) { //reset game } gameUpdate(); } else if(HWREGBITW(&gFlags, TITLE_SCREEN) == True) { drawString("ASTEROIDS", makePoint(40, 38)); gameLevel = 0; } updateXAxis(); gameUpdate(); HWREGBITW(&gFlags, FRAME_BUFFER_READY) = True; } } }