}
// BadGuy fall below the ground
- if (base.y > screen->h) {
+ if (base.y > World::current()->get_level()->height * 32) {
remove_me();
return;
}
void load_object_gfx()
{
+ char sprite_name[16];
+
for (int i = 0; i < TRAMPOLINE_FRAMES; i++)
{
- char sprite_name[16];
sprintf(sprite_name, "trampoline-%i", i+1);
img_trampoline[i] = sprite_manager->load(sprite_name);
}
{
// TODO: Remove if we're too far off the screen
- physic.apply(frame_ratio, base.x, base.y);
-
// Falling
if (mode != M_HELD)
{
base.y = tux.base.y + tux.base.height/1.5 - base.height;
}
}
+
+ physic.apply(frame_ratio, base.x, base.y);
+ collision_swept_object_map(&old_base, &base);
}
void
else
frame = 0;
- if (squish_amount < 24)
+ if (squish_amount < 20)
pplayer_c->physic.set_velocity_y(power);
else if (pplayer_c->physic.get_velocity_y() < 0)
pplayer_c->physic.set_velocity_y(-squish_amount/32);
ptramp_c = (Trampoline*) p_c_object;
// Pick up trampoline
- if (ptramp_c->mode != Trampoline::M_HELD && input.fire == DOWN && !holding_something)
+ if (ptramp_c->mode != Trampoline::M_HELD && input.fire == DOWN && !holding_something && on_ground())
{
holding_something = true;
ptramp_c->mode = Trampoline::M_HELD;
bool Player::is_dead()
{
- if(base.y > screen->h || base.x < scroll_x - AUTOSCROLL_DEAD_INTERVAL) // last condition can happen in auto-scrolling
+ if(base.y > World::current()->get_level()->height * /*TILE_HEIGHT*/ 32 || base.x < scroll_x - AUTOSCROLL_DEAD_INTERVAL) // last condition can happen in auto-scrolling
return true;
else
return false;
}
/* Keep in-bounds, vertically: */
- if (base.y > screen->h)
+ if (base.y > sWorld::current()->get_level()->height * /*TILE_HEIGHT*/ 32)
{
kill(KILL);
}