-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathExplosion.cpp
41 lines (37 loc) · 961 Bytes
/
Explosion.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#include "Explosion.h"
#include <stdlib.h>
#include "DisplayManager.h"
#include "WorldManager.h"
#include "LogManager.h"
#include "Event.h"
#include "EventOut.h"
#include "EventStep.h"
namespace df {
Explosion::Explosion() {
setType("Explosion");
setSprite("explosion");
setSolidness(df::SPECTRAL);
setVelocity(Vector(0, 0));
setAltitude(0); //Puts stars in the background
setPosition(df::Vector(50, 5));
}
//Handles event
int Explosion::eventHandler(const df::Event* p_e) {
if (p_e->getType() == df::STEP_EVENT) {
if (((EventStep*)p_e)->getStepCount() % 450 == 0) {
setPosition(df::Vector(25, 5));
}
if (((EventStep*)p_e)->getStepCount() % 750 == 0) {
setPosition(df::Vector(35, 8));
}
if (((EventStep*)p_e)->getStepCount() % 800 == 0) {
setAltitude(1);
}
}
if (p_e->getType() == df::OUT_EVENT) {
LM.writeLog(3, "EventOut");
return 1;
}
return 0;
}
}