--- /dev/null
+(supertux-sprite
+
+; Earth Tux
+
+ (action
+ (name "earth-walk-right")
+ (hitbox 412 154 32 64)
+ (images "earth/light/stand.png"))
+
+ (action
+ (name "earth-walk-left")
+ (hitbox 412 154 32 64)
+ (mirror-action "earth-walk-right"))
+
+ (action
+ (name "earth-stand-right")
+ (hitbox 412 154 32 64)
+ (images "earth/light/stand.png"))
+
+ (action
+ (name "earth-stand-left")
+ (hitbox 412 154 32 64)
+ (mirror-action "earth-stand-right"))
+
+ (action
+ (name "earth-jump-right")
+ (hitbox 412 154 32 64)
+ (images "earth/light/stand.png"))
+
+ (action
+ (name "earth-jump-left")
+ (hitbox 412 154 32 64)
+ (mirror-action "earth-jump-right"))
+
+ (action
+ (name "earth-skid-right")
+ (hitbox 412 154 32 64)
+ (images "earth/light/stand.png"))
+
+ (action
+ (name "earth-skid-left")
+ (hitbox 412 154 32 64)
+ (mirror-action "earth-skid-right"))
+
+ (action
+ (name "earth-kick-right")
+ (hitbox 412 154 32 64)
+ (images "earth/light/stand.png"))
+
+ (action
+ (name "earth-kick-left")
+ (hitbox 412 154 32 64)
+ (mirror-action "earth-kick-right"))
+
+ (action
+ (name "earth-idle-right")
+ (hitbox 412 154 32 64)
+ (images "earth/light/stand.png"))
+
+ (action
+ (name "earth-idle-left")
+ (hitbox 412 154 32 64)
+ (mirror-action "earth-idle-right"))
+
+ (action
+ (name "earth-climbing-right")
+ (hitbox 412 154 32 64)
+ (images "earth/light/stand.png"))
+
+ (action
+ (name "earth-climbing-left")
+ (hitbox 412 154 32 64)
+ (mirror-action "earth-climbing-right"))
+
+ (action
+ (name "earth-duck-right")
+ (hitbox 412 154 32 64)
+ (images "earth/light/stand.png"))
+
+ (action
+ (name "earth-duck-left")
+ (hitbox 412 154 32 64)
+ (mirror-action "earth-duck-right"))
+
+ (action
+ (name "earth-backflip-right")
+ (hitbox 412 154 32 64)
+ (images "earth/light/stand.png"))
+
+ (action
+ (name "earth-backflip-left")
+ (hitbox 412 154 32 64)
+ (mirror-action "earth-backflip-right"))
+
+ (action
+ (name "earth-buttjump-right")
+ (hitbox 412 154 32 64)
+ (images "earth/light/stand.png"))
+
+ (action
+ (name "earth-buttjump-left")
+ (hitbox 412 154 32 64)
+ (mirror-action "earth-buttjump-right"))
+
+)
--- /dev/null
+(supertux-sprite
+
+; Earth Tux
+
+ (action
+ (name "earth-walk-right")
+ (hitbox 16 14 32 64)
+ (images "earth/hardhat/stand.png"))
+
+ (action
+ (name "earth-walk-left")
+ (hitbox 16 14 32 64)
+ (mirror-action "earth-walk-right"))
+
+ (action
+ (name "earth-stand-right")
+ (hitbox 16 14 32 64)
+ (images "earth/hardhat/stand.png"))
+
+ (action
+ (name "earth-stand-left")
+ (hitbox 16 14 32 64)
+ (mirror-action "earth-stand-right"))
+
+ (action
+ (name "earth-jump-right")
+ (hitbox 16 14 32 64)
+ (images "earth/hardhat/stand.png"))
+
+ (action
+ (name "earth-jump-left")
+ (hitbox 16 14 32 64)
+ (mirror-action "earth-jump-right"))
+
+ (action
+ (name "earth-skid-right")
+ (hitbox 16 14 32 64)
+ (images "earth/hardhat/stand.png"))
+
+ (action
+ (name "earth-skid-left")
+ (hitbox 16 14 32 64)
+ (mirror-action "earth-skid-right"))
+
+ (action
+ (name "earth-kick-right")
+ (hitbox 16 14 32 64)
+ (images "earth/hardhat/stand.png"))
+
+ (action
+ (name "earth-kick-left")
+ (hitbox 16 14 32 64)
+ (mirror-action "earth-kick-right"))
+
+ (action
+ (name "earth-idle-right")
+ (hitbox 16 14 32 64)
+ (images "earth/hardhat/stand.png"))
+
+ (action
+ (name "earth-idle-left")
+ (hitbox 16 14 32 64)
+ (mirror-action "earth-idle-right"))
+
+ (action
+ (name "earth-climbing-right")
+ (hitbox 16 14 32 64)
+ (images "earth/hardhat/stand.png"))
+
+ (action
+ (name "earth-climbing-left")
+ (hitbox 16 14 32 64)
+ (mirror-action "earth-climbing-right"))
+
+ (action
+ (name "earth-duck-right")
+ (hitbox 16 14 32 64)
+ (images "earth/hardhat/stand.png"))
+
+ (action
+ (name "earth-duck-left")
+ (hitbox 16 14 32 64)
+ (mirror-action "earth-duck-right"))
+
+ (action
+ (name "earth-backflip-right")
+ (hitbox 16 14 32 64)
+ (images "earth/hardhat/stand.png"))
+
+ (action
+ (name "earth-backflip-left")
+ (hitbox 16 14 32 64)
+ (mirror-action "earth-backflip-right"))
+
+ (action
+ (name "earth-buttjump-right")
+ (hitbox 16 14 32 64)
+ (images "earth/hardhat/stand.png"))
+
+ (action
+ (name "earth-buttjump-left")
+ (hitbox 16 14 32 64)
+ (mirror-action "earth-buttjump-right"))
+
+)
(hitbox 16 14 32 64)
(mirror-action "ice-buttjump-right"))
+; Earth Tux
+
+ (action
+ (name "earth-walk-right")
+ (fps 15.0)
+ (hitbox 16 14 32 64)
+ (images "big/walk-0.png"
+ "big/walk-1.png"
+ "big/walk-2.png"
+ "big/walk-3.png"
+ "big/walk-4.png"
+ "big/walk-5.png"))
+
+ (action
+ (name "earth-walk-left")
+ (fps 15.0)
+ (hitbox 16 14 32 64)
+ (mirror-action "earth-walk-right"))
+
+ (action
+ (name "earth-stand-right")
+ (fps 15.0)
+ (hitbox 16 14 32 64)
+ (images "big/stand-0.png"))
+
+ (action
+ (name "earth-stand-left")
+ (fps 15.0)
+ (hitbox 16 14 32 64)
+ (mirror-action "earth-stand-right"))
+
+ (action
+ (name "earth-jump-right")
+ (fps 15.0)
+ (hitbox 16 14 32 64)
+ (images "big/jump-0.png"))
+
+ (action
+ (name "earth-jump-left")
+ (fps 15.0)
+ (hitbox 16 14 32 64)
+ (mirror-action "earth-jump-right"))
+
+ (action
+ (name "earth-skid-right")
+ (hitbox 16 14 32 64)
+ (images "big/skid-0.png"))
+
+ (action
+ (name "earth-skid-left")
+ (hitbox 16 14 32 64)
+ (mirror-action "earth-skid-right"))
+
+ (action
+ (name "earth-kick-right")
+ (hitbox 16 14 32 64)
+ (images "big/kick-0.png"))
+
+ (action
+ (name "earth-kick-left")
+ (hitbox 16 14 32 64)
+ (mirror-action "earth-kick-right"))
+
+ (action
+ (name "earth-idle-right")
+ (fps 5.0)
+ (hitbox 16 14 32 64)
+ (images "big/idle-0.png"
+ "big/idle-1.png"
+ "big/idle-0.png"))
+
+ (action
+ (name "earth-idle-left")
+ (hitbox 16 14 32 64)
+ (mirror-action "earth-idle-right"))
+
+ (action
+ (name "earth-climbing-right")
+ (hitbox 16 14 32 64)
+ (images "big/ladder-0.png"
+ "big/ladder-1.png"
+ "big/ladder-2.png"
+ "big/ladder-3.png"
+ "big/ladder-2.png"
+ "big/ladder-1.png"))
+
+ (action
+ (name "earth-climbing-left")
+ (hitbox 16 14 32 64)
+ (mirror-action "earth-climbing-right"))
+
+ (action
+ (name "earth-duck-right")
+ (hitbox 16 45 32 32)
+ (images "big/duck-0.png"))
+
+ (action
+ (name "earth-duck-left")
+ (hitbox 16 45 32 32)
+ (mirror-action "earth-duck-right"))
+
+ (action
+ (name "earth-backflip-right")
+ (hitbox 16 37 32 32)
+ (images "big/backflip.png"))
+
+ (action
+ (name "earth-backflip-left")
+ (hitbox 16 37 32 32)
+ (fps 18.0)
+ (mirror-action "earth-backflip-right"))
+
+ (action
+ (name "earth-buttjump-right")
+ (hitbox 16 14 32 64)
+ (images "big/buttjump-0.png"))
+
+ (action
+ (name "earth-buttjump-left")
+ (hitbox 16 14 32 64)
+ (mirror-action "earth-buttjump-right"))
+
+; Stone Tux
+
+ (action
+ (name "earth-walk-right-stone")
+ (fps 15.0)
+ (hitbox 16 14 32 64)
+ (images "earth/stand.png"))
+
+ (action
+ (name "earth-walk-left-stone")
+ (fps 15.0)
+ (hitbox 16 14 32 64)
+ (mirror-action "earth-walk-right-stone"))
+
+ (action
+ (name "earth-stand-right-stone")
+ (fps 15.0)
+ (hitbox 16 14 32 64)
+ (images "earth/stand.png"))
+
+ (action
+ (name "earth-stand-left-stone")
+ (fps 15.0)
+ (hitbox 16 14 32 64)
+ (mirror-action "earth-stand-right-stone"))
+
+ (action
+ (name "earth-jump-right-stone")
+ (fps 15.0)
+ (hitbox 16 14 32 64)
+ (images "earth/stand.png"))
+
+ (action
+ (name "earth-jump-left-stone")
+ (fps 15.0)
+ (hitbox 16 14 32 64)
+ (mirror-action "earth-jump-right-stone"))
+
+ (action
+ (name "earth-skid-right-stone")
+ (hitbox 16 14 32 64)
+ (images "earth/stand.png"))
+
+ (action
+ (name "earth-skid-left-stone")
+ (hitbox 16 14 32 64)
+ (mirror-action "earth-skid-right-stone"))
+
+ (action
+ (name "earth-kick-right-stone")
+ (hitbox 16 14 32 64)
+ (images "earth/stand.png"))
+
+ (action
+ (name "earth-kick-left-stone")
+ (hitbox 16 14 32 64)
+ (mirror-action "earth-kick-right-stone"))
+
+ (action
+ (name "earth-idle-right-stone")
+ (fps 5.0)
+ (hitbox 16 14 32 64)
+ (images "earth/stand.png"))
+
+ (action
+ (name "earth-idle-left-stone")
+ (hitbox 16 14 32 64)
+ (mirror-action "earth-idle-right-stone"))
+
+ (action
+ (name "earth-climbing-right-stone")
+ (hitbox 16 14 32 64)
+ (images "earth/stand.png"))
+
+ (action
+ (name "earth-climbing-left-stone")
+ (hitbox 16 14 32 64)
+ (mirror-action "earth-climbing-right-stone"))
+
+ (action
+ (name "earth-duck-right-stone")
+ (hitbox 16 45 32 32)
+ (images "earth/stand.png"))
+
+ (action
+ (name "earth-duck-left-stone")
+ (hitbox 16 45 32 32)
+ (mirror-action "earth-duck-right-stone"))
+
+ (action
+ (name "earth-backflip-right-stone")
+ (hitbox 16 37 32 32)
+ (images "earth/stand.png"))
+
+ (action
+ (name "earth-backflip-left-stone")
+ (hitbox 16 37 32 32)
+ (fps 18.0)
+ (mirror-action "earth-backflip-right-stone"))
+
+ (action
+ (name "earth-buttjump-right-stone")
+ (hitbox 16 14 32 64)
+ (images "earth/stand.png"))
+
+ (action
+ (name "earth-buttjump-left-stone")
+ (hitbox 16 14 32 64)
+ (mirror-action "earth-buttjump-right-stone"))
+
)
--- /dev/null
+(supertux-sprite
+ (action
+ (name "right")
+ (fps 1)
+ (images
+ "icetux-cap.png"
+ )
+ )
+ (action
+ (name "left")
+ (fps 1)
+ (mirror-action "right")
+ )
+)
--- /dev/null
+(supertux-sprite
+ (action
+ (name "right")
+ (fps 1)
+ (images "earthtux-hardhat.png")
+ )
+ (action
+ (name "left")
+ (fps 1)
+ (mirror-action "right")
+ )
+)
static const float BUTTJUMP_MIN_VELOCITY_Y = 400.0f;
static const float SHOOTING_TIME = .150f;
static const float GLIDE_TIME_PER_FLOWER = 0.5f;
+static const float STONE_TIME_PER_FLOWER = 2.0f;
/** number of idle stages, including standing */
static const unsigned int IDLE_STAGE_COUNT = 5;
backflip_direction(),
peekingX(),
peekingY(),
- glide_time(),
+ ability_time(),
stone(),
swimming(),
speedlimit(),
jump_early_apex(),
on_ice(),
ice_this_frame(),
- lightsprite(SpriteManager::current()->create("images/objects/lightmap_light/lightmap_light-tiny.sprite")),
+ lightsprite(SpriteManager::current()->create("images/creatures/tux/light.sprite")),
+ powersprite(SpriteManager::current()->create("images/creatures/tux/powerups.sprite")),
dir(),
old_dir(),
last_ground_y(),
backflip_direction = 0;
sprite->set_angle(0.0f);
visible = true;
- glide_time = 0;
+ ability_time = 0;
stone = false;
swimming = false;
on_ice = false;
do_standup();
}
if (player_status->bonus == AIR_BONUS)
- glide_time = player_status->max_air_time * GLIDE_TIME_PER_FLOWER;
+ ability_time = player_status->max_air_time * GLIDE_TIME_PER_FLOWER;
}
// calculate movement for this frame
}
// airflower glide only when holding jump key
} else if (controller->hold(Controller::JUMP) && player_status->bonus == AIR_BONUS && physic.get_velocity_y() > MAX_GLIDE_YM) {
- if (glide_time > 0 && !ability_timer.started())
- ability_timer.start(glide_time);
+ if (ability_time > 0 && !ability_timer.started())
+ ability_timer.start(ability_time);
else if (ability_timer.started()) {
// glide stops after some duration or if buttjump is initiated
if ((ability_timer.get_timeleft() <= 0.05f) || controller->hold(Controller::DOWN)) {
- glide_time = 0;
+ ability_time = 0;
ability_timer.stop();
} else {
physic.set_velocity_y(MAX_GLIDE_YM);
early_jump_apex();
}
if (player_status->bonus == AIR_BONUS && ability_timer.started()){
- glide_time = ability_timer.get_timeleft();
+ ability_time = ability_timer.get_timeleft();
ability_timer.stop();
}
}
}
/* Turn to Stone */
- if (controller->pressed(Controller::DOWN) && player_status->bonus == EARTH_BONUS) {
- if (controller->hold(Controller::ACTION)) {
- jump_early_apex = false;
+ if (controller->pressed(Controller::DOWN) && player_status->bonus == EARTH_BONUS && !cooldown_timer.started()) {
+ if (controller->hold(Controller::ACTION) && !ability_timer.started()) {
+ ability_timer.start(player_status->max_earth_time * STONE_TIME_PER_FLOWER);
stone = true;
+ physic.set_gravity_modifier(1.0f); // Undo jump_early_apex
}
}
apply_friction();
/* Revert from Stone */
- if (stone && !controller->hold(Controller::ACTION))
+ if (stone && (!controller->hold(Controller::ACTION) || ability_timer.get_timeleft() <= 0.5f)) {
+ cooldown_timer.start(ability_timer.get_timegone()/2.0f); //The longer stone form is used, the longer until it can be used again
+ ability_timer.stop();
stone = false;
+ for (int i = 0; i < 8; i++)
+ {
+ Vector ppos = Vector(get_bbox().get_left() + 8 + 16*((int)i/4), get_bbox().get_top() + 16*(i%4));
+ float grey = graphicsRandom.randf(.4f, .8f);
+ Color pcolor = Color(grey, grey, grey);
+ Sector::current()->add_object(std::make_shared<Particles>(ppos, -60, 240, 42, 81, Vector(0, 500),
+ 8, pcolor, 4 + graphicsRandom.randf(-0.4, 0.4),
+ 0.8 + graphicsRandom.randf(0, 0.4), LAYER_OBJECTS+2));
+ }
+ }
/* Duck or Standup! */
if (controller->hold(Controller::DOWN) && !stone) {
Vector pspeed = Vector(((dir==LEFT) ? +100 : -100), -300);
Vector paccel = Vector(0, 1000);
std::string action = (dir==LEFT)?"left":"right";
- Sector::current()->add_object(std::make_shared<SpriteParticle>("images/objects/particles/icetux-cap.sprite", action, ppos, ANCHOR_TOP, pspeed, paccel, LAYER_OBJECTS-1));
+ Sector::current()->add_object(std::make_shared<SpriteParticle>("images/objects/particles/airtux-hat.sprite", action, ppos, ANCHOR_TOP, pspeed, paccel, LAYER_OBJECTS-1));
if (climbing) stop_climbing(*climbing);
}
if ((player_status->bonus == EARTH_BONUS) && (animate)) {
Vector pspeed = Vector(((dir==LEFT) ? +100 : -100), -300);
Vector paccel = Vector(0, 1000);
std::string action = (dir==LEFT)?"left":"right";
- Sector::current()->add_object(std::make_shared<SpriteParticle>("images/objects/particles/firetux-helmet.sprite", action, ppos, ANCHOR_TOP, pspeed, paccel, LAYER_OBJECTS-1));
+ Sector::current()->add_object(std::make_shared<SpriteParticle>("images/objects/particles/earthtux-hardhat.sprite", action, ppos, ANCHOR_TOP, pspeed, paccel, LAYER_OBJECTS-1));
if (climbing) stop_climbing(*climbing);
}
player_status->max_fire_bullets = 0;
else if (player_status->bonus == AIR_BONUS)
sa_prefix = "ice";
else if (player_status->bonus == EARTH_BONUS)
- sa_prefix = "fire";
+ sa_prefix = "earth";
else
sa_prefix = "small";
// do_duck() will take care of cancelling growing manually
// update() will take care of cancelling when growing completed
}
+ else if (stone) {
+ sprite->set_action(sprite->get_action()+"-stone");
+ }
else if (climbing) {
sprite->set_action(sa_prefix+"-climbing"+sa_postfix);
}
}
}
+ /* Set Tux powerup sprite action */
+ if (player_status->bonus == EARTH_BONUS) {
+ powersprite->set_action(sprite->get_action());
+ lightsprite->set_action(sprite->get_action());
+ }
+
/*
// Tux is holding something
if ((grabbed_object != 0 && physic.get_velocity_y() == 0) ||
/* Draw Tux */
if (safe_timer.started() && size_t(game_time*40)%2)
; // don't draw Tux
- else {
- sprite->draw(context, get_pos(), LAYER_OBJECTS + 1);
- // draw light with earthflower bonus
- if (player_status->bonus == EARTH_BONUS){
- context.push_target();
- context.set_target(DrawingContext::LIGHTMAP);
- lightsprite->draw(context, get_pos() + Vector(dir==LEFT ? 0 : 32, 0), 0);
- context.pop_target();
+ else if (player_status->bonus == EARTH_BONUS){ // draw special effects with earthflower bonus
+ // shake at end of maximum stone duration
+ Vector shake_delta = (stone && ability_timer.get_timeleft() < 1.0f) ? Vector(graphicsRandom.rand(-3,3), 0) : Vector(0,0);
+ sprite->draw(context, get_pos() + shake_delta, LAYER_OBJECTS + 1);
+ // draw hardhat
+ powersprite->draw(context, get_pos(), LAYER_OBJECTS + 1);
+ // light
+ context.push_target();
+ context.set_target(DrawingContext::LIGHTMAP);
+ lightsprite->draw(context, get_pos()/* + Vector(dir==LEFT ? 0 : 32, 0)*/, 0);
+ context.pop_target();
+ // give an indicator that stone form cannot be used for a while
+ if (cooldown_timer.started() && graphicsRandom.rand(0, 4) == 0) {
+ float px = graphicsRandom.randf(bbox.p1.x, bbox.p2.x);
+ float py = bbox.p2.y+8;
+ Vector ppos = Vector(px, py);
+ Sector::current()->add_object(std::make_shared<SpriteParticle>(
+ "images/objects/particles/sparkle.sprite", "dark",
+ ppos, ANCHOR_MIDDLE, Vector(0, 0), Vector(0, 0), LAYER_OBJECTS+1+5));
}
}
+ else
+ sprite->draw(context, get_pos(), LAYER_OBJECTS + 1);
}
physic.set_velocity_y(controller->hold(Controller::JUMP) ? -520 : -300);
else {
physic.set_velocity_y(controller->hold(Controller::JUMP) ? -580 : -340);
- glide_time = player_status->max_air_time * GLIDE_TIME_PER_FLOWER;
+ ability_time = player_status->max_air_time * GLIDE_TIME_PER_FLOWER;
}
}
int backflip_direction;
Direction peekingX;
Direction peekingY;
- float glide_time;
+ float ability_time;
bool stone;
bool swimming;
float speedlimit;
bool on_ice;
bool ice_this_frame;
SpritePtr lightsprite;
+ SpritePtr powersprite;
public:
Direction dir;