- if(World::current()->trybreakbrick(base.x, base.y + base.height, false)
- || World::current()->trybreakbrick(
- base.x + base.width, base.y + base.height, false)) {
- // make tux jumping a little bit again after breaking the bricks
- physic.set_velocity_y(2);
+ stomp_timer.start(STOMP_TIME);
+ butt_jump = false;
+
+ // Break bricks beneath Tux
+ if(Sector::current()->trybreakbrick(
+ Vector(base.x + 1, base.y + base.height), false)
+ || Sector::current()->trybreakbrick(
+ Vector(base.x + base.width - 1, base.y + base.height), false))
+ {
+ physic.set_velocity_y(2);
+ butt_jump = true;
+ }
+
+ // Kill nearby badguys
+ std::vector<GameObject*> gameobjects = Sector::current()->gameobjects;
+ for (std::vector<GameObject*>::iterator i = gameobjects.begin();
+ i != gameobjects.end();
+ i++)
+ {
+ BadGuy* badguy = dynamic_cast<BadGuy*> (*i);
+ if(badguy)
+ {
+
+ if (fabsf(base.x - badguy->base.x) < 150 &&
+ fabsf(base.y - badguy->base.y) < 60 &&
+ (issolid(badguy->base.x + 1, badguy->base.y + badguy->base.height) ||
+ issolid(badguy->base.x + badguy->base.width - 1, badguy->base.y + badguy->base.height)))
+ badguy->kill_me(25);
+ }