draw_tile(context, shape.id, position + Vector(0, offset), LAYER_TILES+1);
}
-FloatingText::FloatingText(const Vector& pos, std::string& text_)
+FloatingText::FloatingText(const Vector& pos, const std::string& text_)
: position(pos), text(text_)
{
timer.start(1000);
class FloatingText : public GameObject
{
public:
- FloatingText(const Vector& pos, std::string& text_);
+ FloatingText(const Vector& pos, const std::string& text_);
FloatingText(const Vector& pos, int s); // use this for score, for instance
virtual void action(float elapsed_time);
#include <cassert>
#include "app/globals.h"
+#include "app/gettext.h"
#include "player.h"
#include "defines.h"
#include "scene.h"
physic.enable_gravity(false);
/* Reset score multiplier (for multi-hits): */
if (!invincible_timer.started())
+ {
+ if(player_status.score_multiplier > 2)
+ { // show a message
+ char str[124];
+ sprintf(str, _("%d bad guys in a row!"), player_status.score_multiplier-1);
+ Sector::current()->add_floating_text(base, str);
+ }
player_status.score_multiplier = 1;
+ }
}
if(jumped_in_solid)
return true;
}
+void
+Sector::add_floating_text(const Vector& pos, const std::string& text)
+{
+ add_object(new FloatingText(pos, text));
+}
+
/* Break a brick: */
bool
Sector::trybreakbrick(const Vector& pos, bool small)
bool add_bullet(const Vector& pos, float xm, Direction dir);
bool add_smoke_cloud(const Vector& pos);
bool add_particles(const Vector& epicenter, const Vector& velocity, const Vector& acceleration, int number, Color color, int size, int life_time);
+ void add_floating_text(const Vector& pos, const std::string& text);
/** Try to grab the coin at the given coordinates */
void trygrabdistro(const Vector& pos, int bounciness);
int distro_counter;
bool counting_distros;
- int currentmusic;
+ int currentmusic;
};
#endif