9 #include "app/globals.h"
10 #include "special/sprite_manager.h"
12 GrowUp::GrowUp(const Vector& pos)
15 bbox.set_size(32, 32);
17 sprite = sprite_manager->create("egg");
18 physic.enable_gravity(true);
19 physic.set_velocity_x(100);
28 GrowUp::action(float elapsed_time)
30 movement = physic.get_movement(elapsed_time);
34 GrowUp::collision(GameObject& other, const CollisionHit& hit)
36 if(other.get_flags() & FLAG_SOLID) {
37 if(fabsf(hit.normal.y) > .5) { // roof or ground
38 physic.set_velocity_y(0);
39 } else { // bumped left or right
40 physic.set_velocity_x(-physic.get_velocity_x());
46 Player* player = dynamic_cast<Player*>(&other);
49 SoundManager::get()->play_sound(IDToSound(SND_EXCELLENT));
59 GrowUp::draw(DrawingContext& context)
61 sprite->draw(context, get_pos(), LAYER_OBJECTS);