#include "object/tilemap.hpp"
#include "object/camera.hpp"
#include "tile.hpp"
+#include "random_generator.hpp"
#define LIFETIME 5
#define MOVETIME 0.75
static const float Y_OFFSCREEN_DISTANCE = 1200;
Kugelblitz::Kugelblitz(const lisp::Lisp& reader)
- : groundhit_pos_set(false)
+ : BadGuy(Vector(0,0), "images/creatures/kugelblitz/kugelblitz.sprite"), groundhit_pos_set(false)
{
reader.get("x", start_position.x);
- start_position.y = 0; //place above visible area
- bbox.set_size(63.8, 63.8);
- sprite = sprite_manager->create("images/creatures/kugelblitz/kugelblitz.sprite");
sprite->set_action("falling");
physic.enable_gravity(false);
}
void
Kugelblitz::activate()
{
- physic.set_velocity_y(-300);
+ physic.set_velocity_y(300);
physic.set_velocity_x(-20); //fall a little to the left
direction = 1;
dying = false;
(get_bbox().p1.y + get_bbox().p2.y) / 2) {
// if it's not is it possible to squish us, then this will hurt
if(!collision_squished(player))
- player.kill(Player::SHRINK);
+ player.kill(false);
explode();
return FORCE_MOVE;
}
- player.kill(Player::SHRINK);
+ player.kill(false);
explode();
return FORCE_MOVE;
}
sprite->set_action("flying");
physic.set_velocity_y(0);
//Set random initial speed and direction
- if ((rand() % 2) == 1) direction = 1; else direction = -1;
- int speed = (BASE_SPEED + (rand() % RAND_SPEED)) * direction;
+ direction = systemRandom.rand(2)? 1: -1;
+ int speed = (BASE_SPEED + (systemRandom.rand(RAND_SPEED))) * direction;
physic.set_velocity_x(speed);
movement_timer.start(MOVETIME);
lifetime.start(LIFETIME);
if (groundhit_pos_set) {
if (movement_timer.check()) {
if (direction == 1) direction = -1; else direction = 1;
- int speed = (BASE_SPEED + (rand() % RAND_SPEED)) * direction;
+ int speed = (BASE_SPEED + (systemRandom.rand(RAND_SPEED))) * direction;
physic.set_velocity_x(speed);
movement_timer.start(MOVETIME);
}