Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "bomb.h"
- #include "particle.h"
- #include <stdio.h>
- #include <iostream>
- using namespace std;
- Bomb::Bomb() {
- x = 0.0;
- bombClockTime = 10;
- flightTime = 0;
- cout << "Bomb Created at::" << endl;
- cout << "X: " << x << endl;
- }
- Bomb::Bomb(double _x, int _bombClockTime, int _flightTime) {
- x = _x;
- bombClockTime = _bombClockTime;
- flightTime = _flightTime;
- cout << "Bomb Created at::" << endl;
- cout << "X: " << x << endl;
- }
- void Bomb::fly(double speed) {
- x += speed;
- flightTime++;
- if (flightTime >= bombClockTime){
- blowUp();
- }
- }
- void Bomb::blowUp(){
- Particle particle;
- for(int i=0;i<x;i++){ //the further it goes, the more particles that are emitted
- particle = new Particle();
- for(int j=0;j<10;j++){
- particle.fly();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement