Player& tux = *Sector::current()->player;
end_sequence_controller = new CodeController();
tux.set_controller(end_sequence_controller);
+ tux.set_speedlimit(230); //MAX_WALK_XM
starting();
}
backflip_direction = 0;
visible = true;
swimming = false;
+ speedlimit = 0; //no special limit
on_ground_flag = false;
grabbed_object = NULL;
Scripting::unexpose_object(vm, table_idx, name);
}
+float
+Player::get_speedlimit()
+{
+ return speedlimit;
+}
+
+void
+Player::set_speedlimit(float newlimit)
+{
+ speedlimit=newlimit;
+}
+
void
Player::set_controller(Controller* controller)
{
vx = dirsign * WALK_SPEED;
}
+ //Check speedlimit.
+ if( speedlimit > 0 && vx * dirsign >= speedlimit ) {
+ vx = dirsign * speedlimit;
+ ax = 0;
+ }
+
// changing directions?
if(on_ground() && ((vx < 0 && dirsign >0) || (vx>0 && dirsign<0))) {
// let's skid!
PlayerStatus* player_status;
bool duck;
bool dead;
+ //Tux can only go this fast. If set to 0 no special limit is used, only the default limits.
+ void set_speedlimit(float newlimit);
+ float get_speedlimit();
private:
bool dying;
int backflip_direction;
Direction peeking;
bool swimming;
+ float speedlimit;
public:
Direction dir;
Player* player = titlesession->get_current_sector()->player;
player->set_controller(controller.get());
+ player->set_speedlimit(230); //MAX_WALK_XM
main_menu.reset(new Menu());
main_menu->set_pos(SCREEN_WIDTH/2, 335);