}
void
-BadGuy::init(float x, float y, BadGuyKind kind_)
+BadGuy::init(float x, float y, BadGuyKind kind_, bool stay_on_platform_)
{
base.x = x;
base.y = y;
base.xm = 0;
base.ym = 0;
- stay_on_platform = false;
+ stay_on_platform = stay_on_platform_;
mode = NORMAL;
dying = DYING_NOT;
kind = kind_;
float animation_speed;
public:
- void init(float x, float y, BadGuyKind kind);
+ void init(float x, float y, BadGuyKind kind, bool stay_on_platform);
void action(float frame_ratio);
void draw();
LispReader reader(lisp_cdr(data));
reader.read_int("x", &bg_data.x);
reader.read_int("y", &bg_data.y);
+ reader.read_bool("stay-on-platform", &bg_data.stay_on_platform);
badguy_data.push_back(bg_data);
for(std::vector<BadGuyData>::iterator it = badguy_data.begin();
it != badguy_data.end();
++it)
- fprintf( fi,"(%s (x %d) (y %d))\n",badguykind_to_string((*it).kind).c_str(),(*it).x,(*it).y);
+ fprintf( fi,"(%s (x %d) (y %d) (stay-on-platform %s))\n",
+ badguykind_to_string((*it).kind).c_str(),(*it).x,(*it).y,
+ it->stay_on_platform ? "#t" : "#f");
fprintf( fi,")\n");
bad_guys.push_back(BadGuy());
BadGuy& new_bad_guy = bad_guys.back();
- new_bad_guy.init(x,y,kind);
+ new_bad_guy.init(x,y,kind, false /* stay_on_platform */);
}
void activate_bad_guys()
i != level->badguy_data.end();
++i)
{
- add_bad_guy(i->x, i->y, i->kind);
+ add_bad_guy(i->x, i->y, i->kind, i->stay_on_platform);
}
}
}
void
-World::add_bad_guy(float x, float y, BadGuyKind kind)
+World::add_bad_guy(float x, float y, BadGuyKind kind, bool stay_on_platform)
{
bad_guys.push_back(BadGuy());
BadGuy& new_bad_guy = bad_guys.back();
- new_bad_guy.init(x,y,kind);
+ new_bad_guy.init(x,y,kind, stay_on_platform);
}
void
void add_broken_brick(Tile* tile, float x, float y);
void add_broken_brick_piece(Tile* tile, float x, float y, float xm, float ym);
void add_bouncy_brick(float x, float y);
- void add_bad_guy(float x, float y, BadGuyKind kind);
+ void add_bad_guy(float x, float y, BadGuyKind kind, bool stay_on_platform = false);
void add_upgrade(float x, float y, Direction dir, UpgradeKind kind);
void add_bullet(float x, float y, float xm, Direction dir);