Advertisement
keysle

Untitled

May 12th, 2012
49
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.86 KB | None | 0 0
  1. #include "bomb.h"
  2. #include "particle.h"
  3. #include <stdio.h>
  4. #include <iostream>
  5. using namespace std;
  6.  
  7. Bomb::Bomb() {
  8.         x = 0.0;
  9.         bombClockTime = 10;
  10.         flightTime = 0;
  11.         cout << "Bomb Created at::" << endl;
  12.         cout << "X: " << x << endl;
  13. }
  14.  
  15. Bomb::Bomb(double _x, int _bombClockTime, int _flightTime) {
  16.         x = _x;
  17.         bombClockTime = _bombClockTime;
  18.         flightTime = _flightTime;
  19.         cout << "Bomb Created at::" << endl;
  20.         cout << "X: " << x << endl;
  21. }
  22.  
  23. void Bomb::fly(double speed) {
  24.         x += speed;
  25.         flightTime++;
  26.  
  27.         if (flightTime >= bombClockTime){
  28.                 blowUp();
  29.         }
  30. }
  31.  
  32. void Bomb::blowUp(){
  33.     Particle particle;
  34.     for(int i=0;i<x;i++){ //the further it goes, the more particles that are emitted
  35.         particle = new Particle();
  36.         for(int j=0;j<10;j++){
  37.             particle.fly();
  38.         }
  39.     }
  40. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement