1 class SkyLaunch : public Superpower
2 {
3
4 protected:
5 virtual void activate()
6 {
7 if (getHeroZ() == 0)
8 {
9 // On the ground, so spring into the air.
10 playSound(SOUND_SPROING, 1.0f);
11 spawnParticles(PARTICLE_DUST, 10);
12 move(0, 0, 20);
13 }
14 else if (getHeroZ() < 10.0f)
15 {
16 // Near the ground, so do a double jump.
17 playSound(SOUND_SWOOP, 1.0f);
18 move(0, 0, getHeroZ() - 20);
19 }
20 else
21 {
22 // Way up in the air, so do a dive attack.
23 playSound(SOUND_DIVE, 0.7f);
24 spawnParticles(PARTICLE_SPARKLES, 1);
25 move(0, 0, -getHeroZ());
26 }
27 }
28
29 };