X-Git-Url: https://git.verplant.org/?a=blobdiff_plain;f=src%2Fobject%2Fbullet.hpp;h=c3464d7d5344330786491a65d5fe1f933199f799;hb=ca967dcf4ee89f99880355be00782d1cd047be6a;hp=c5eb76dc7eba71331a974e2ea908d0253b580207;hpb=a113d3bd1feddd510e3b2852b0d42522735eee40;p=supertux.git diff --git a/src/object/bullet.hpp b/src/object/bullet.hpp index c5eb76dc7..c3464d7d5 100644 --- a/src/object/bullet.hpp +++ b/src/object/bullet.hpp @@ -23,11 +23,12 @@ #include "moving_object.hpp" #include "physic.hpp" #include "sprite/sprite.hpp" +#include "player_status.hpp" -class Bullet : public MovingObject +class Bullet : public MovingObject, private UsesPhysic { public: - Bullet(const Vector& pos, float xm, int dir); + Bullet(const Vector& pos, float xm, int dir, BonusType type); ~Bullet(); void update(float elapsed_time); @@ -35,10 +36,22 @@ public: void collision_solid(const CollisionHit& hit); HitResponse collision(GameObject& other, const CollisionHit& hit); + /** + * Makes bullet bounce off an object (that got hit). + * To be called by the collision handler of that object. + * Note that the @c hit parameter is filled in as perceived by the object, not by the bullet. + */ + void ricochet(GameObject& other, const CollisionHit& hit); + + BonusType get_type() + { + return type; + } + private: int life_count; - Physic physic; std::auto_ptr sprite; + BonusType type; }; #endif