Add some more sound_manager->preloads into object constructors
[supertux.git] / src / object / bullet.cpp
index 3d1b228..a8b7cef 100644 (file)
@@ -1,7 +1,7 @@
 //  $Id$
-// 
+//
 //  SuperTux
-//  Copyright (C) 2005 Matthias Braun <matze@braunis.de>
+//  Copyright (C) 2006 Matthias Braun <matze@braunis.de>
 //
 //  This program is free software; you can redistribute it and/or
 //  modify it under the terms of the GNU General Public License
 //  but WITHOUT ANY WARRANTY; without even the implied warranty of
 //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 //  GNU General Public License for more details.
-// 
+//
 //  You should have received a copy of the GNU General Public License
 //  along with this program; if not, write to the Free Software
-//  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
-//  02111-1307, USA.
+//  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+
 #include <config.h>
 
 #include <math.h>
-#include "bullet.h"
-#include "resources.h"
-#include "camera.h"
-#include "sector.h"
-#include "sprite/sprite_manager.h"
-#include "badguy/badguy.h"
-#include "main.h"
+#include "bullet.hpp"
+#include "resources.hpp"
+#include "camera.hpp"
+#include "sector.hpp"
+#include "sprite/sprite_manager.hpp"
+#include "badguy/badguy.hpp"
+#include "main.hpp"
 
-static const float BULLET_XM = 300;
+static const float BULLET_XM = 600;
 static const float BULLET_STARTING_YM = 0;
 
 Bullet::Bullet(const Vector& pos, float xm, int dir, int kind_)
@@ -39,13 +39,13 @@ Bullet::Bullet(const Vector& pos, float xm, int dir, int kind_)
 
   float speed = dir == RIGHT ? BULLET_XM : -BULLET_XM;
   physic.set_velocity_x(speed + xm);
-  physic.set_velocity_y(-BULLET_STARTING_YM);
+  physic.set_velocity_y(BULLET_STARTING_YM);
 
   if (kind == ICE_BULLET) {
     life_count = 6; //ice-bullets get "extra lives" for bumping off walls
-    sprite = sprite_manager->create("icebullet");
+    sprite = sprite_manager->create("images/objects/bullets/icebullet.sprite");
   } else if(kind == FIRE_BULLET) {
-    sprite = sprite_manager->create("firebullet");
+    sprite = sprite_manager->create("images/objects/bullets/firebullet.sprite");
   }
 }
 
@@ -59,7 +59,7 @@ Bullet::update(float elapsed_time)
 {
   if(kind == FIRE_BULLET) {
     // @not completely framerate independant :-/
-    physic.set_velocity_y(physic.get_velocity_y() - 50 * elapsed_time);
+    physic.set_velocity_y(physic.get_velocity_y() + 50 * elapsed_time);
   }
   if(physic.get_velocity_y() > 900)
     physic.set_velocity_y(900);
@@ -105,9 +105,9 @@ Bullet::collision(GameObject& other, const CollisionHit& hit)
     return CONTINUE;
   }
 
+  // hit a Badguy
   BadGuy* badguy = dynamic_cast<BadGuy*> (&other);
   if(badguy) {
-    badguy->kill_fall();
     remove_me();
     return FORCE_MOVE;
   }