(background (image "arctis.jpg")
(speed 0.5))
(secretarea (x 400) (y 128) (message "You found a secret area!"))
- (dispenser (x 500) (y 128) (badguy "snowball") (cycle 3))
+ (dispenser (x 500) (y 128) (badguy "bouncingsnowball") (cycle 2))
(spawn-points
(name "main")
(x 100)
#include "dispenser.h"
#include "badguy/bouncing_snowball.h"
+#include "badguy/snowball.h"
+
Dispenser::Dispenser(LispReader& reader)
{
reader.read_float("cycle", cycle);
reader.read_string("badguy", badguy);
bbox.set_size(32, 32);
+ //FIXME: Create dispenser sprite
sprite = sprite_manager->create("snowball");
}
void
Dispenser::activate()
-{
+{
dispense_timer.start(cycle, true);
+ launch_badguy();
}
bool
Dispenser::active_action(float elapsed_time)
{
if (dispense_timer.check()) {
- Sector::current()->add_object(new BouncingSnowball(get_pos().x, get_pos().y));
+ launch_badguy();
}
}
return CONTINUE;
}
+
+//TODO: Add launching velocity to badguys
+// Add more badguys and randomizer
+// Clean up stuff I copied without understanding what it does :)
+// Lots-O-Stuff (tm)
+void
+Dispenser::launch_badguy()
+{
+ //FIXME: Does is_offscreen() work right here?
+ if (!is_offscreen()) {
+ if (badguy == "snowball")
+ Sector::current()->add_object(new SnowBall(get_pos().x-2, get_pos().y));
+ else if (badguy == "bouncingsnowball")
+ Sector::current()->add_object(new BouncingSnowball(get_pos().x-2, get_pos().y));
+ else if (badguy == "random")
+ {}
+ }
+}
sprite = sprite_manager->create("mrbomb");
}
+MrBomb::MrBomb(float pos_x, float pos_y)
+{
+ start_position.x = pos_x;
+ start_position.y = pos_y;
+ bbox.set_size(32, 32);
+ sprite = sprite_manager->create("mrbomb");
+}
+
void
MrBomb::write(LispWriter& writer)
{
sprite = sprite_manager->create("snowball");
}
+SnowBall::SnowBall(float pos_x, float pos_y)
+{
+ start_position.x = pos_x;
+ start_position.y = pos_y;
+ bbox.set_size(32, 32);
+ sprite = sprite_manager->create("snowball");
+}
+
void
SnowBall::write(LispWriter& writer)
{