From 5b74a56fe2d78ee295cd5445acf5a0ba640f0bd5 Mon Sep 17 00:00:00 2001 From: Christoph Sommer Date: Wed, 28 Jun 2006 23:21:37 +0000 Subject: [PATCH] Made backflipping jump a little further / Tux loses Firetux status when backflipping SVN-Revision: 3801 --- data/images/objects/particles/firetux-helmet.png | Bin 0 -> 1610 bytes data/images/objects/particles/firetux-helmet.sprite | 8 ++++++++ src/object/player.cpp | 19 +++++++++++++++---- 3 files changed, 23 insertions(+), 4 deletions(-) create mode 100644 data/images/objects/particles/firetux-helmet.png create mode 100644 data/images/objects/particles/firetux-helmet.sprite diff --git a/data/images/objects/particles/firetux-helmet.png b/data/images/objects/particles/firetux-helmet.png new file mode 100644 index 0000000000000000000000000000000000000000..73a405014857c442d4f81a3806d4fb8a925e3c78 GIT binary patch literal 1610 zcmV-Q2DSN#P)n+a03CEi zSad^gZEa<4bO1wgWnpw>WFU8GbZ8({Xk{QrNlj4iWF>9@00pi|L_t(Y$EDTFiyYS# z$MNs2y479X)zgn@je4f%rIC>p1%egfg>2$Q6qy8p0?sCm$Vy}t5gS7cS!!c%g0X@j zIFO}r;y8&!cCidipWdUES4Hb??o>lF>pDigNyd--p9F z_gukKR3Aj<+BH{?6dS$sj)?Ex{iZF%d12en6UPPN zc}gWo-|Urt}T)ce2Sy;G-zn4f=9)@pAjH*S0br7U}L5)nn1 zN(HA>!ir;)-n^MAA*{4m6eda9YHI33>h+)Z?%Zh}`}9-uKf%fJvemzM@rODH-qJxZ z8?USgBPAF^rd~%!5q7zZ<$0)VmVTo_yIQ5Zxv35o3W+Y2_QvJ%#hF)M{Xo3(%J_-l z-h~T4Rn6v))$Z=0baPW^V=z+UOi!b_T~rj2MiK6b6ZGnJ#F;ZF$01%>p?vL{DX*`` zmg_d;%P;>d`^+<+IOoo#53=pY!EYWscv)?4Pp6xkLZ>N_G04FH-S0y_PdprAc6YIh zMcmh3qxjr&c(b#(hYk_v^CGvlX1g03m9*LX?CSjd@^7zR4IgA%|FzrKU;mD2wa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.sprite b/data/images/objects/particles/firetux-helmet.sprite new file mode 100644 index 000000000..000d9df25 --- /dev/null +++ b/data/images/objects/particles/firetux-helmet.sprite @@ -0,0 +1,8 @@ +(supertux-sprite + (action + (fps 1) + (images + "firetux-helmet.png" + ) + ) +) diff --git a/src/object/player.cpp b/src/object/player.cpp index 5104012ed..fc659bf54 100644 --- a/src/object/player.cpp +++ b/src/object/player.cpp @@ -48,6 +48,7 @@ #include "log.hpp" #include "falling_coin.hpp" #include "random_generator.hpp" +#include "object/sprite_particle.hpp" static const int TILES_FOR_BUTTJUMP = 3; static const float SHOOTING_TIME = .150; @@ -228,7 +229,7 @@ Player::update(float elapsed_time) if (backflipping) { //prevent player from changing direction when backflipping dir = (backflip_direction == 1) ? LEFT : RIGHT; - if (backflip_timer.check()) physic.set_velocity_x(100 * backflip_direction); + if (backflip_timer.started()) physic.set_velocity_x(100 * backflip_direction); } // set fall mode... @@ -484,6 +485,9 @@ Player::do_backflip() { if (!duck) return; if (!on_ground()) return; + // TODO: we don't have an animation for firetux backflipping, so let's revert to bigtux + set_bonus(GROWUP_BONUS, true); + backflip_direction = (dir == LEFT)?(+1):(-1); backflipping = true; do_jump(-580); @@ -686,6 +690,13 @@ Player::set_bonus(BonusType type, bool animate) } if ((type == NO_BONUS) || (type == GROWUP_BONUS)) { + if ((player_status->bonus == FIRE_BONUS) && (animate)) { + // visually lose helmet + Vector ppos = Vector((bbox.p1.x + bbox.p2.x) / 2, bbox.p1.y); + Vector pspeed = Vector(((dir==LEFT) ? +100 : -100), -300); + Vector paccel = Vector(0, 1000); + Sector::current()->add_object(new SpriteParticle("images/objects/particles/firetux-helmet.sprite", ppos, ANCHOR_TOP, pspeed, paccel, LAYER_OBJECTS+1)); + } player_status->max_fire_bullets = 0; player_status->max_ice_bullets = 0; } @@ -998,13 +1009,13 @@ Player::kill(bool completely) if(player_status->bonus == FIRE_BONUS || player_status->bonus == ICE_BONUS) { safe_timer.start(TUX_SAFE_TIME); - set_bonus(GROWUP_BONUS); + set_bonus(GROWUP_BONUS, true); } else { //growing_timer.start(GROWING_TIME); safe_timer.start(TUX_SAFE_TIME /* + GROWING_TIME */); adjust_height(30.8); duck = false; - set_bonus(NO_BONUS); + set_bonus(NO_BONUS, true); } } else { for (int i = 0; (i < 5) && (i < player_status->coins); i++) @@ -1018,7 +1029,7 @@ Player::kill(bool completely) physic.set_acceleration(0, 0); physic.set_velocity(0, -700); player_status->coins -= 25; - set_bonus(NO_BONUS); + set_bonus(NO_BONUS, true); dying = true; dying_timer.start(3.0); set_group(COLGROUP_DISABLED); -- 2.11.0