- if (kind == UPGRADE_MINTS ||
- kind == UPGRADE_HERRING)
- {
- base.x = base.x + base.xm * frame_ratio;
- base.y = base.y + base.ym * frame_ratio;
-
- collision_swept_object_map(&old_base,&base);
-
- /* Off the screen? Kill it! */
-
- if (base.x < scroll_x - base.width)
- World::current()->upgrades.erase(static_cast<std::vector<Upgrade>::iterator>(this));
- if (base.y > screen->h)
- World::current()->upgrades.erase(static_cast<std::vector<Upgrade>::iterator>(this));
-
- if (issolid(base.x + 1, base.y + 32.) ||
- issolid(base.x + 31., base.y + 32.))
- {
- if (base.ym > 0)
- {
- if (kind == UPGRADE_MINTS)
- {
- base.ym = 0;
- }
- else if (kind == UPGRADE_HERRING)
- {
- base.ym = -8;
- }
-
- base.y = (int)(base.y / 32) * 32;
- }
- }
- else
- base.ym = base.ym + GRAVITY * frame_ratio;
-
- if (issolid(base.x - 1, (int) base.y))
- {
- if(base.xm < 0)
- base.xm = -base.xm;
- }
- else if (issolid(base.x + base.width, (int) base.y))
- {
- if(base.xm > 0)
- base.xm = -base.xm;
- }
+ /* 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);