* Forgot to check in implementations of stay-on-platform for Mr Bomb and Mr Iceblock; doing so now
* Little fix to statistics
* Fixes to a few converted bonus2 levels
* Anubis's level now has a custom extro
SVN-Revision: 2997
(leveltime
(time 400)
)
+ (camera
+ (mode "normal")
+ )
(spawnpoint
(name "main")
(x 100)
)
)
(background
- (color_top 0 0 0)
- (color_bottom 255 255 255)
- (speed 0.5)
+ (top_color 0.0 0.0 0.0)
+ (bottom_color 1.0 1.0 1.0)
)
(leveltime
(time 200)
(version 2)
(name (_ "Going Underground"))
(author "Anubis")
+ (extro
+ (music "gameover_forest.ogg")
+ (length 12.7)
+ )
(sector
(name "main")
(music "forest2.ogg")
else if (badguy == "bouncingsnowball")
Sector::current()->add_object(new BouncingSnowball(get_pos().x, get_pos().y+32, dir));
else if (badguy == "mrbomb")
- Sector::current()->add_object(new MrBomb(get_pos().x, get_pos().y+32, dir));
+ Sector::current()->add_object(new MrBomb(get_pos().x, get_pos().y+32, dir, false));
else if (badguy == "mriceblock")
- Sector::current()->add_object(new MrIceBlock(get_pos().x, get_pos().y+32, dir));
+ Sector::current()->add_object(new MrIceBlock(get_pos().x, get_pos().y+32, dir, false));
else if (badguy == "snowsnail")
Sector::current()->add_object(new SnowSnail(get_pos().x, get_pos().y+32, dir));
else if (badguy == "mrrocket") {
{
case 0: Sector::current()->add_object(new SnowBall(get_pos().x, get_pos().y+32, dir)); break;
case 1: Sector::current()->add_object(new BouncingSnowball(get_pos().x, get_pos().y+32, dir)); break;
- case 2: Sector::current()->add_object(new MrBomb(get_pos().x, get_pos().y+32, dir)); break;
- case 3: Sector::current()->add_object(new MrIceBlock(get_pos().x, get_pos().y+32, dir)); break;
+ case 2: Sector::current()->add_object(new MrBomb(get_pos().x, get_pos().y+32, dir, false)); break;
+ case 3: Sector::current()->add_object(new MrIceBlock(get_pos().x, get_pos().y+32, dir, false)); break;
case 4: Sector::current()->add_object(new PoisonIvy(get_pos().x, get_pos().y+32, dir)); break;
case 5: Sector::current()->add_object(new SnowSnail(get_pos().x, get_pos().y+32, dir)); break;
}
{
reader.get("x", start_position.x);
reader.get("y", start_position.y);
+ stay_on_platform = false;
+ reader.get("stay-on-platform", stay_on_platform);
bbox.set_size(31.8, 31.8);
sprite = sprite_manager->create("images/creatures/mr_bomb/mr_bomb.sprite");
set_direction = false;
}
-MrBomb::MrBomb(float pos_x, float pos_y, Direction d)
+MrBomb::MrBomb(float pos_x, float pos_y, Direction d, bool stay_on_plat = false)
{
start_position.x = pos_x;
start_position.y = pos_y;
+ stay_on_platform = stay_on_plat;
bbox.set_size(31.8, 31.8);
sprite = sprite_manager->create("images/creatures/mr_bomb/mr_bomb.sprite");
set_direction = true;
writer.write_float("x", start_position.x);
writer.write_float("y", start_position.y);
+ writer.write_bool("stay-on-platform", stay_on_platform);
writer.end_list("mrbomb");
}
sprite->set_action(dir == LEFT ? "left" : "right");
}
+void
+MrBomb::active_update(float elapsed_time)
+{
+ if (stay_on_platform && may_fall_off_platform())
+ {
+ dir = (dir == LEFT ? RIGHT : LEFT);
+ sprite->set_action(dir == LEFT ? "left" : "right");
+ physic.set_velocity_x(-physic.get_velocity_x());
+ }
+
+ BadGuy::active_update(elapsed_time);
+}
+
bool
MrBomb::collision_squished(Player& player)
{
{
public:
MrBomb(const lisp::Lisp& reader);
- MrBomb(float pos_x, float pos_y, Direction d);
+ MrBomb(float pos_x, float pos_y, Direction d, bool stay_on_plat);
void activate();
+ void active_update(float elapsed_time);
void write(lisp::Writer& writer);
HitResponse collision_solid(GameObject& other, const CollisionHit& hit);
HitResponse collision_badguy(BadGuy& badguy, const CollisionHit& hit);
protected:
bool collision_squished(Player& player);
bool set_direction;
+ bool stay_on_platform;
Direction initial_direction;
};
{
reader.get("x", start_position.x);
reader.get("y", start_position.y);
+ stay_on_platform = false;
reader.get("stay-on-platform", stay_on_platform);
bbox.set_size(31.8, 31.8);
sprite = sprite_manager->create("mriceblock");
set_direction = false;
}
-MrIceBlock::MrIceBlock(float pos_x, float pos_y, Direction d)
+MrIceBlock::MrIceBlock(float pos_x, float pos_y, Direction d, bool stay_on_plat = false )
: ice_state(ICESTATE_NORMAL), squishcount(0)
{
start_position.x = pos_x;
start_position.y = pos_y;
+ stay_on_platform = stay_on_plat;
bbox.set_size(31.8, 31.8);
sprite = sprite_manager->create("mriceblock");
set_direction = true;
writer.write_float("x", start_position.x);
writer.write_float("y", start_position.y);
+ writer.write_bool("stay-on-platform", stay_on_platform);
writer.end_list("mriceblock");
}
{
public:
MrIceBlock(const lisp::Lisp& reader);
- MrIceBlock(float pos_x, float pos_y, Direction d);
+ MrIceBlock(float pos_x, float pos_y, Direction d, bool stay_on_plat);
void activate();
void write(lisp::Writer& writer);
return;
end_sequence = ENDSEQUENCE_RUNNING;
- endsequence_timer.start(7.0); // 7 seconds until we finish the map
+ endsequence_timer.start(level->extro_length); // 7 seconds until we finish the map
last_x_pos = -1;
- sound_manager->play_music("music/leveldone.ogg", false);
- currentsector->player->invincible_timer.start(7.0);
+ sound_manager->play_music("music/" + level->extro_music, false);
+ currentsector->player->invincible_timer.start(level->extro_length);
if(sequencename == "fireworks") {
currentsector->add_object(new Fireworks());
using namespace std;
Level::Level()
- : name("noname"), author("Mr. X")
+ : name("noname"), author("Mr. X"), extro_music("leveldone.ogg"), extro_length(7.0)
{
}
iter.value()->get(name);
} else if(token == "author") {
iter.value()->get(author);
+ } else if(token == "extro") {
+ const lisp::Lisp* ext = iter.lisp();
+ lisp::ListIterator ext_iter(ext);
+ while(ext_iter.next()) {
+ const std::string& ext_token = ext_iter.item();
+ if(ext_token == "music") {
+ ext_iter.value()->get(extro_music);
+ } else if(ext_token == "length") {
+ ext_iter.value()->get(extro_length);
+ }
+ }
} else if(token == "sector") {
Sector* sector = new Sector;
sector->parse(*(iter.lisp()));
public:
std::string name;
std::string author;
+ std::string extro_music;
+ float extro_length;
typedef std::vector<Sector*> Sectors;
Sectors sectors;
//sprintf(str, _( "Max score: %d"), stats[SCORE_STAT][SPLAYER]);
//context.draw_text(white_text, str, Vector(SCREEN_WIDTH/2, 450), CENTER_ALLIGN, LAYER_GUI);
- for(int i = 1; i < NUM_STATS; i++)
+ for(int i = 0; i < NUM_STATS; i++)
{
if(i == COINS_COLLECTED_STAT)
sprintf(str, _("Max coins collected: %d / %d"),
sprintf(str, _("Max fragging: %d / %d"),
stats[BADGUYS_KILLED_STAT][SPLAYER],
stats[BADGUYS_KILLED_STAT][STOTAL]);
- else// if(i == TIME_NEEDED_STAT)
+ else if((i == TIME_NEEDED_STAT) && (stats[TIME_NEEDED_STAT][STOTAL] != -1))
sprintf(str, _("Min time needed: %d / %d"),
stats[TIME_NEEDED_STAT][SPLAYER],
stats[TIME_NEEDED_STAT][STOTAL]);
+ else
+ continue;
// y == (462 + i*18) before score removal
- context.draw_text(white_small_text, str, Vector(SCREEN_WIDTH/2, 450 + i*18), CENTER_ALLIGN, LAYER_GUI);
+ context.draw_text(white_small_text, str, Vector(SCREEN_WIDTH/2, 450 + (i+1)*18), CENTER_ALLIGN, LAYER_GUI);
}
}