+ if (kind == UPGRADE_ICEFLOWER || kind == UPGRADE_FIREFLOWER
+ || kind == UPGRADE_GROWUP) {
+ if (base.height < 32) {
+ /* Rise up! */
+ base.height = base.height + 0.7 * elapsed_time;
+ if(base.height > 32)
+ base.height = 32;
+
+ return;
+ }
+ }
+
+ /* Away from the screen? Kill it! */
+ float scroll_x =
+ Sector::current()->camera->get_translation().x;
+ float scroll_y =
+ Sector::current()->camera->get_translation().y;
+
+ if(base.x < scroll_x - X_OFFSCREEN_DISTANCE ||
+ base.x > scroll_x + screen->w + X_OFFSCREEN_DISTANCE ||
+ base.y < scroll_y - Y_OFFSCREEN_DISTANCE ||
+ base.y > scroll_y + screen->h + Y_OFFSCREEN_DISTANCE)
+ {
+ remove_me();
+ return;
+ }
+
+ /* Move around? */
+ physic.apply(elapsed_time, base.x, base.y, Sector::current()->gravity);
+ if(kind == UPGRADE_GROWUP || kind == UPGRADE_STAR) {
+ collision_swept_object_map(&old_base, &base);
+ }
+
+ // fall down?
+ if(kind == UPGRADE_GROWUP || kind == UPGRADE_STAR) {
+ // falling?
+ if(physic.get_velocity_y() != 0) {
+ if(issolid(base.x, base.y + base.height)) {
+ base.y = int(base.y / 32) * 32;
+ old_base = base;
+ if(kind == UPGRADE_GROWUP) {
+ physic.enable_gravity(false);
+ physic.set_velocity(dir == LEFT ? -GROWUP_SPEED : GROWUP_SPEED, 0);
+ } else if(kind == UPGRADE_STAR) {
+ physic.set_velocity(dir == LEFT ? -2 : 2, 3);
+ }
+ }
+ } else {
+ if((physic.get_velocity_x() < 0
+ && !issolid(base.x+base.width, base.y + base.height))
+ || (physic.get_velocity_x() > 0
+ && !issolid(base.x, base.y + base.height))) {
+ physic.enable_gravity(true);
+ }
+ }
+ }
+
+ // horizontal bounce?
+ if(kind == UPGRADE_GROWUP || kind == UPGRADE_STAR) {
+ if ( (physic.get_velocity_x() < 0
+ && issolid(base.x, (int) base.y + base.height/2))
+ || (physic.get_velocity_x() > 0
+ && issolid(base.x + base.width, (int) base.y + base.height/2))) {
+ physic.set_velocity(-physic.get_velocity_x(),physic.get_velocity_y());
+ dir = dir == LEFT ? RIGHT : LEFT;
+ }
+ }
+}