{
const CameraConfig& config = *(this->config);
Player* player = sector->player;
- const Vector& player_pos = Vector(player->get_bbox().get_middle().x,
+ // TODO: co-op mode needs a good camera
+ Vector player_pos(player->get_bbox().get_middle().x,
player->get_bbox().get_bottom());
static Vector last_player_pos = player_pos;
Vector player_delta = player_pos - last_player_pos;
this->name = name;
controller = g_main_controller;
scripting_controller.reset(new CodeController());
+ // if/when we have complete penny gfx, we can
+ // load those instead of Tux's sprite in the
+ // constructor
sprite = sprite_manager->create("images/creatures/tux/tux.sprite");
airarrow = Surface::create("images/engine/hud/airarrow.png");
idle_timer.start(IDLE_TIME[0]/1000.0f);
return FORCE_MOVE;
}
+ Player* player = dynamic_cast<Player*> (&other);
+ if(player) {
+ return ABORT_MOVE;
+ }
+
if(hit.left || hit.right) {
try_grab(); //grab objects right now, in update it will be too late
}
dying_timer.start(3.0);
set_group(COLGROUP_DISABLED);
+ // TODO: need nice way to handle players dying in co-op mode
Sector::current()->effect->fade_out(3.0);
sound_manager->stop_music(3.0);
}
}
try_expose_me();
- // spawn smalltux below spawnpoint
- if (!player->is_big()) {
- player->move(player_pos + Vector(0,32));
- } else {
- player->move(player_pos);
- }
- // spawning tux in the ground would kill him
- if(!is_free_of_tiles(player->get_bbox())) {
- log_warning << "Tried spawning Tux in solid matter. Compensating." << std::endl;
- Vector npos = player->get_bbox().p1;
- npos.y-=32;
- player->move(npos);
+ // two-player hack: move other players to main player's position
+ // Maybe specify 2 spawnpoints in the level?
+ for(GameObjects::iterator i = gameobjects.begin();
+ i != gameobjects.end(); ++i) {
+ Player* p = dynamic_cast<Player*>(*i);
+ if (!p) continue;
+
+ // spawn smalltux below spawnpoint
+ if (!p->is_big()) {
+ p->move(player_pos + Vector(0,32));
+ } else {
+ p->move(player_pos);
+ }
+
+ // spawning tux in the ground would kill him
+ if(!is_free_of_tiles(p->get_bbox())) {
+ log_warning << "Tried spawning Tux in solid matter. Compensating." << std::endl;
+ Vector npos = p->get_bbox().p1;
+ npos.y-=32;
+ p->move(npos);
+ }
}
camera->reset(player->get_pos());