#include "object/camera.hpp"
#include "object/player.hpp"
#include "sprite/sprite.hpp"
+#include "sprite/sprite_manager.hpp"
#include "supertux/object_factory.hpp"
#include "supertux/sector.hpp"
#include "util/reader.hpp"
movement_timer(),
lifetime(),
direction(),
- state()
+ state(),
+ light(0.0f,0.0f,0.0f),
+ lightsprite(sprite_manager->create("images/objects/lightmap_light/lightmap_light.sprite"))
{
reader.get("x", start_position.x);
sprite->set_action("falling");
physic.enable_gravity(false);
countMe = false;
+
+ lightsprite->set_blend(Blend(GL_SRC_ALPHA, GL_ONE));
+ lightsprite->set_color(Color(0.2f, 0.1f, 0.0f));
}
void
sprite->set_action("flying");
physic.set_velocity_y(0);
//Set random initial speed and direction
- direction = systemRandom.rand(2)? 1: -1;
- int speed = (BASE_SPEED + (systemRandom.rand(RAND_SPEED))) * direction;
+ direction = gameRandom.rand(2)? 1: -1;
+ int speed = (BASE_SPEED + (gameRandom.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 + (systemRandom.rand(RAND_SPEED))) * direction;
+ int speed = (BASE_SPEED + (gameRandom.rand(RAND_SPEED))) * direction;
physic.set_velocity_x(speed);
movement_timer.start(MOVETIME);
}
}
void
+Kugelblitz::draw(DrawingContext& context)
+{
+ sprite->draw(context, get_pos(), layer);
+
+ //Only draw light in dark areas
+ context.get_light( get_bbox().get_middle(), &light );
+ if (light.red + light.green < 2.0){
+ context.push_target();
+ context.set_target(DrawingContext::LIGHTMAP);
+ sprite->draw(context, get_pos(), layer);
+ lightsprite->draw(context, get_bbox().get_middle(), 0);
+ context.pop_target();
+ }
+}
+
+void
Kugelblitz::kill_fall()
{
}