#include "tile.h"
#include "resources.h"
#include "sprite_manager.h"
+#include "gameloop.h"
Sprite* img_mriceblock_flat_left;
Sprite* img_mriceblock_flat_right;
float halfheight = base.height / 2;
if (dir == LEFT && issolid( base.x, (int) base.y + halfheight))
{
+ if (kind == BAD_MRICEBLOCK && mode == KICK)
+ World::current()->trybreakbrick(base.x, (int) base.y + halfheight, false);
+
dir = RIGHT;
physic.set_velocity(-physic.get_velocity_x(), physic.get_velocity_y());
return;
}
if (dir == RIGHT && issolid( base.x + base.width, (int)base.y + halfheight))
{
+ if (kind == BAD_MRICEBLOCK && mode == KICK)
+ World::current()->trybreakbrick(base.x + base.width, (int) base.y + halfheight, false);
+
dir = LEFT;
physic.set_velocity(-physic.get_velocity_x(), physic.get_velocity_y());
return;
}
// BadGuy fall below the ground
- if (base.y > screen->h) {
+ if (base.y > World::current()->get_level()->height * 32) {
remove_me();
return;
}
+ // Kill us if we landed on spikes
+ if (dying == DYING_NOT
+ && (kind != BAD_STALACTITE && kind != BAD_FLAME && kind != BAD_BOMB)
+ && (isspike(base.x, base.y) || isspike(base.x + base.width, base.y)
+ || isspike(base.x, base.y + base.height)
+ || isspike(base.x + base.width, base.y + base.height)))
+ {
+ physic.set_velocity_y(3);
+ kill_me(0);
+ }
+
// Once it's on screen, it's activated!
if (base.x <= scroll_x + screen->w + OFFSCREEN_DISTANCE)
seen = true;
tux.holding_something = false;
}
}
-
+
physic.enable_gravity(true);
/* Gain some points: */
+ if (score != 0)
World::current()->add_score(base.x, base.y,
score * player_status.score_multiplier);
if(pbullet_c->kind == FIRE_BULLET)
{
- if(kind == BAD_MRICEBLOCK || kind == BAD_STALACTITE ||
- kind == BAD_FISH || kind == BAD_BOUNCINGSNOWBALL ||
- kind == BAD_FLYINGSNOWBALL || kind == BAD_FLYINGSNOWBALL)
- kill_me(10);
+ if (kind != BAD_BOMB && kind != BAD_STALACTITE && kind != BAD_FLAME)
+ kill_me(10);
}
else if(pbullet_c->kind == ICE_BULLET)
{
- if(kind == BAD_FLAME)
- kill_me(10);
- else
+ //if(kind == BAD_FLAME)
+ // kill_me(10);
+ //else
frozen_timer.start(FROZEN_TIME);
}
break;
case CO_BADGUY:
pbad_c = (BadGuy*) p_c_object;
- /* If we're a kicked mriceblock, kill any badguys we hit */
- if(kind == BAD_MRICEBLOCK && mode == KICK)
+ /* If we're a kicked mriceblock, kill [almost] any badguys we hit */
+ if(kind == BAD_MRICEBLOCK && mode == KICK &&
+ kind != BAD_FLAME && kind != BAD_BOMB && kind != BAD_STALACTITE)
{
pbad_c->kill_me(25);
}
- // a held mriceblock gets kills the enemy too but falls to ground then
+ // a held mriceblock kills the enemy too but falls to ground then
else if(kind == BAD_MRICEBLOCK && mode == HELD)
{
pbad_c->kill_me(25);
physic.set_velocity(-fabsf(physic.get_velocity_x()), 2);
}
-
-
break;
}
else if (base.y + base.height > pbad_c->base.y + pbad_c->base.height)
{
dir = RIGHT;
physic.set_velocity_x(fabsf(physic.get_velocity_x()));
+
+ // in case badguys get "jammed"
+ if (physic.get_velocity_x() != 0)
+ base.x = pbad_c->base.x + pbad_c->base.width;
}
else if (dir == RIGHT)
{