Advertisement
keysle

Untitled

May 12th, 2012
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.89 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.         cout << "Y: " << y << endl;
  14. }
  15.  
  16. Bomb::Bomb(double _x, int _bombClockTime, int _flightTime) {
  17.         x = _x;
  18.         bombClockTime = _bombClockTime;
  19.         flightTime = _flightTime;
  20.         cout << "Bomb Created at::" << endl;
  21.         cout << "X: " << x << endl;
  22. }
  23.  
  24. void Bomb::fly(double speed) {
  25.         x += speed;
  26.         flightTime++;
  27.  
  28.         if (flightTime >= bombClockTime){
  29.                 blowUp();
  30.         }
  31. }
  32.  
  33. void Bomb::blowUp(){
  34.     Particle particle;
  35.     for(int i=0;i<x;i++){ //the further it goes, the more particles that are emitted
  36.         particle = new Particle();
  37.         for(int j=0;j<10;j++){
  38.             particle.fly();
  39.         }
  40.     }
  41. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement