super metroid style camera
[supertux.git] / src / object / gameobjs.cpp
index 78adbbe..1eed690 100644 (file)
 #include "video/drawing_context.hpp"
 #include "camera.hpp"
 #include "main.hpp"
+#include "random_generator.hpp"
 
 BouncyCoin::BouncyCoin(const Vector& pos)
   : position(pos)
 {
-  timer.start(.3);
+  timer.start(.3f);
   sprite = sprite_manager->create("images/objects/coin/coin.sprite");
   sprite->set_action("still");
 }
@@ -61,7 +62,7 @@ BouncyCoin::update(float elapsed_time)
 void
 BouncyCoin::draw(DrawingContext& context)
 {
-  sprite->draw(context, position, LAYER_OBJECTS);
+  sprite->draw(context, position, LAYER_OBJECTS + 5);
 }
 
 //---------------------------------------------------------------------------
@@ -70,7 +71,7 @@ BrokenBrick::BrokenBrick(Sprite* nsprite,
     const Vector& pos, const Vector& nmovement)
   : sprite(new Sprite(*nsprite)), position(pos), movement(nmovement)
 {
-  timer.start(.2);
+  timer.start(.2f);
 }
 
 BrokenBrick::~BrokenBrick()
@@ -91,7 +92,7 @@ void
 BrokenBrick::draw(DrawingContext& context)
 {
   sprite->draw_part(context,
-      Vector(rand() % 16, rand() % 16), Vector(16, 16),
+      Vector(systemRandom.rand(16), systemRandom.rand(16)), Vector(16, 16),
       position, LAYER_OBJECTS + 1);
 }
 
@@ -100,14 +101,14 @@ BrokenBrick::draw(DrawingContext& context)
 FloatingText::FloatingText(const Vector& pos, const std::string& text_)
   : position(pos), text(text_)
 {
-  timer.start(.1);
+  timer.start(.1f);
   position.x -= text.size() * 8;
 }
 
 FloatingText::FloatingText(const Vector& pos, int score)
   : position(pos)
 {
-  timer.start(.1);
+  timer.start(.1f);
 
   // turn int into a string
   char str[10];
@@ -141,7 +142,7 @@ FloatingText::draw(DrawingContext& context)
   context.push_transform();
   context.set_alpha(alpha);
 
-  context.draw_text(gold_text, text, position, LEFT_ALLIGN, LAYER_OBJECTS+1);
+  context.draw_text(gold_text, text, position, ALIGN_LEFT, LAYER_OBJECTS+1);
 
   context.pop_transform();
 }
@@ -151,7 +152,7 @@ Sprite *img_smoke_cloud = 0;
 SmokeCloud::SmokeCloud(const Vector& pos)
   : position(pos)
 {
-  timer.start(.3);
+  timer.start(.3f);
   sprite = sprite_manager->create("images/objects/particles/stomp.sprite");
 }
 
@@ -174,4 +175,3 @@ SmokeCloud::draw(DrawingContext& context)
 {
   sprite->draw(context, position, LAYER_OBJECTS+1);
 }
-