#include "object/sprite_particle.hpp"
static const int TILES_FOR_BUTTJUMP = 3;
-static const float SHOOTING_TIME = .150;
+static const float SHOOTING_TIME = .150f;
/// time before idle animation starts
-static const float IDLE_TIME = 2.5;
+static const float IDLE_TIME = 2.5f;
static const float WALK_ACCELERATION_X = 300;
static const float RUN_ACCELERATION_X = 400;
static const float SKID_XM = 200;
-static const float SKID_TIME = .3;
+static const float SKID_TIME = .3f;
static const float MAX_WALK_XM = 230;
static const float MAX_RUN_XM = 320;
static const float WALK_SPEED = 100;
-static const float KICK_TIME = .3;
-static const float CHEER_TIME = 1;
+static const float KICK_TIME = .3f;
+static const float CHEER_TIME = 1.0f;
-static const float UNDUCK_HURT_TIME = 0.25; /**< if Tux cannot unduck for this long, he will get hurt */
+static const float UNDUCK_HURT_TIME = 0.25f; /**< if Tux cannot unduck for this long, he will get hurt */
// growing animation
Surface* growingtux_left[GROWING_FRAMES];
Player::init()
{
if(is_big())
- set_size(31.8, 62.8);
+ set_size(31.8f, 62.8f);
else
- set_size(31.8, 30.8);
+ set_size(31.8f, 30.8f);
dir = RIGHT;
old_dir = dir;
void
Player::set_speedlimit(float newlimit)
{
- speedlimit=newlimit;
+ speedlimit=newlimit;
}
void
if(fabsf(physic.get_velocity_x()) > MAX_WALK_XM) {
set_width(34);
} else {
- set_width(31.8);
+ set_width(31.8f);
}
// on downward slopes, adjust vertical velocity so tux walks smoothly down
new Particles(
Vector(dir == RIGHT ? get_bbox().p2.x : get_bbox().p1.x, get_bbox().p2.y),
dir == RIGHT ? 270+20 : 90-40, dir == RIGHT ? 270+40 : 90-20,
- Vector(280, -260), Vector(0, 300), 3, Color(.4, .4, .4), 3, .8,
+ Vector(280, -260), Vector(0, 300), 3, Color(.4f, .4f, .4f), 3, .8f,
LAYER_OBJECTS+1));
ax *= 2.5;
if (!on_ground())
return;
- if (adjust_height(31.8)) {
+ if (adjust_height(31.8f)) {
duck = true;
unduck_hurt_timer.stop();
} else {
if (backflipping)
return;
- if (adjust_height(63.8)) {
+ if (adjust_height(63.8f)) {
duck = false;
unduck_hurt_timer.stop();
} else {
backflipping = true;
do_jump(-580);
sound_manager->play("sounds/flip.wav");
- backflip_timer.start(0.15);
+ backflip_timer.start(0.15f);
}
void
}
}
-void
+void
Player::try_grab()
{
if(controller->hold(Controller::ACTION) && !grabbed_object
Player::set_bonus(BonusType type, bool animate)
{
if(player_status->bonus == NO_BONUS) {
- if (!adjust_height(62.8)) {
+ if (!adjust_height(62.8f)) {
printf("can't adjust\n");
return false;
}
floor_normal = hit.slope_normal;
} else if(hit.top) {
if(physic.get_velocity_y() < 0)
- physic.set_velocity_y(.2);
+ physic.set_velocity_y(.2f);
}
if(hit.left || hit.right) {
} else if(player_status->bonus == GROWUP_BONUS) {
//growing_timer.start(GROWING_TIME);
safe_timer.start(TUX_SAFE_TIME /* + GROWING_TIME */);
- adjust_height(30.8);
+ adjust_height(30.8f);
duck = false;
set_bonus(NO_BONUS, true);
} else if(player_status->bonus == NO_BONUS) {
growing_timer.stop();
safe_timer.start(TUX_SAFE_TIME);
- adjust_height(30.8);
+ adjust_height(30.8f);
duck = false;
}
} else {
// TODO: do we need the following? Seems irrelevant to moving the player
if(is_big())
- set_size(31.8, 63.8);
+ set_size(31.8f, 63.8f);
else
- set_size(31.8, 31.8);
+ set_size(31.8f, 31.8f);
duck = false;
last_ground_y = vector.y;