3 // SuperTux - A Jump'n Run
4 // Copyright (C) 2003 Tobias Glaesser <tobi.web@gmx.de>
6 // This program is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU General Public License
8 // as published by the Free Software Foundation; either version 2
9 // of the License, or (at your option) any later version.
11 // This program is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 // GNU General Public License for more details.
16 // You should have received a copy of the GNU General Public License
17 // along with this program; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
24 #include "app/globals.h"
25 #include "app/gettext.h"
30 #include "special/sprite.h"
35 #include "resources.h"
36 #include "interactive_object.h"
37 #include "video/screen.h"
38 #include "statistics.h"
41 // behavior definitions:
42 #define TILES_FOR_BUTTJUMP 3
43 // animation times (in ms):
44 #define SHOOTING_TIME 320
46 #define AUTOSCROLL_DEAD_INTERVAL 300
48 // time before idle animation starts
49 #define IDLE_TIME 2500
52 Surface* growingtux_left[GROWING_FRAMES];
53 Surface* growingtux_right[GROWING_FRAMES];
57 Sprite* smalltux_gameover;
58 Sprite* smalltux_star;
61 TuxBodyParts* small_tux;
62 TuxBodyParts* big_tux;
63 TuxBodyParts* fire_tux;
64 TuxBodyParts* ice_tux;
68 PlayerKeymap::PlayerKeymap()
70 keymap.jump = SDLK_SPACE;
71 keymap.activate = SDLK_UP;
72 keymap.duck = SDLK_DOWN;
73 keymap.left = SDLK_LEFT;
74 keymap.right = SDLK_RIGHT;
75 keymap.fire = SDLK_LCTRL;
78 void player_input_init(player_input_type* pplayer_input)
80 pplayer_input->down = UP;
81 pplayer_input->fire = UP;
82 pplayer_input->left = UP;
83 pplayer_input->old_fire = UP;
84 pplayer_input->right = UP;
85 pplayer_input->up = UP;
86 pplayer_input->old_up = UP;
87 pplayer_input->activate = UP;
91 TuxBodyParts::set_action(std::string action)
94 head->set_action(action);
96 body->set_action(action);
98 arms->set_action(action);
100 feet->set_action(action);
104 TuxBodyParts::one_time_animation()
107 head->start_animation(1);
109 body->start_animation(1);
111 arms->start_animation(1);
113 feet->start_animation(1);
117 TuxBodyParts::draw(DrawingContext& context, const Vector& pos, int layer,
118 Uint32 drawing_effect)
121 head->draw(context, pos, layer-1, drawing_effect);
123 body->draw(context, pos, layer-3, drawing_effect);
125 arms->draw(context, pos, layer, drawing_effect);
127 feet->draw(context, pos, layer-2, drawing_effect);
142 holding_something = false;
148 got_power = NONE_POWER;
152 previous_base = old_base = base;
160 fall_mode = ON_GROUND;
165 falling_from_flap = false;
166 enable_hover = false;
172 player_input_init(&input);
174 invincible_timer.init(true);
175 skidding_timer.init(true);
176 safe_timer.init(true);
177 frame_timer.init(true);
178 kick_timer.init(true);
179 shooting_timer.init(true);
180 growing_timer.init(true);
181 idle_timer.init(true);
182 flapping_timer.init(true);
188 Player::key_event(SDLKey key, int state)
190 idle_timer.start(IDLE_TIME);
192 if(key == keymap.right)
197 else if(key == keymap.left)
202 else if(key == keymap.jump)
207 else if(key == keymap.duck)
212 else if(key == keymap.fire)
219 else if(key == keymap.activate)
221 input.activate = state;
224 /** check for interactive objects */
225 for(Sector::InteractiveObjects::iterator i
226 = Sector::current()->interactive_objects.begin();
227 i != Sector::current()->interactive_objects.end(); ++i) {
228 if(rectcollision(base, (*i)->get_area())) {
229 (*i)->interaction(INTERACTION_ACTIVATE);
241 Player::level_begin()
245 previous_base = old_base = base;
250 player_input_init(&input);
252 invincible_timer.init(true);
253 skidding_timer.init(true);
254 safe_timer.init(true);
255 frame_timer.init(true);
256 growing_timer.init(true);
257 idle_timer.init(true);
263 Player::action(float elapsed_time)
265 bool jumped_in_solid = false;
267 if(dying && !dying_timer.check()) {
272 if (input.fire == UP)
273 holding_something = false;
276 previous_base = base;
278 /* --- HANDLE TUX! --- */
279 if(dying == DYING_NOT)
282 physic.apply(elapsed_time, base.x, base.y, Sector::current()->gravity);
284 if(dying == DYING_NOT)
286 base_type target = base;
288 collision_swept_object_map(&old_base, &base);
290 if ((!invincible_timer.started() && !safe_timer.started())
291 && (isspike(base.x, base.y) || isspike(base.x + base.width, base.y)
292 || isspike(base.x, base.y + base.height)
293 || isspike(base.x + base.width, base.y + base.height)))
298 // Don't accelerate Tux if he is running against a wall
299 if (target.x != base.x)
301 physic.set_velocity_x(0);
304 // special exception for cases where we're stuck under tiles after
305 // being ducked. In this case we drift out
306 if(!duck && on_ground() && old_base.x == base.x && old_base.y == base.y
307 && collision_object_map(base))
309 base.x += elapsed_time * WALK_SPEED * (dir ? 1: -1);
310 previous_base = old_base = base;
316 physic.enable_gravity(true);
320 physic.set_velocity_y(0);
321 jumped_in_solid = true;
329 if (physic.get_velocity_y() < 0)
331 base.y = (int)(((int)base.y / 32) * 32);
332 physic.set_velocity_y(0);
335 physic.enable_gravity(false);
336 /* Reset score multiplier (for multi-hits): */
337 if (!invincible_timer.started())
339 /*if(player_status.score_multiplier > 2)
342 sprintf(str, _("%d bad guys in a row!"), player_status.score_multiplier-1);
343 Sector::current()->add_floating_text(base, str);
345 player_status.score_multiplier = 1;
351 if (isbrick(base.x, base.y) ||
352 isfullbox(base.x, base.y))
354 Sector::current()->trygrabdistro(
355 Vector(base.x, base.y - 32), BOUNCE);
356 Sector::current()->trybumpbadguy(Vector(base.x, base.y - 64));
358 Sector::current()->trybreakbrick(
359 Vector(base.x, base.y), size == SMALL);
361 bumpbrick(base.x, base.y);
362 Sector::current()->tryemptybox(Vector(base.x, base.y), RIGHT);
365 if (isbrick(base.x+ 31, base.y) ||
366 isfullbox(base.x+ 31, base.y))
368 Sector::current()->trygrabdistro(
369 Vector(base.x+ 31, base.y - 32), BOUNCE);
370 Sector::current()->trybumpbadguy(Vector(base.x+ 31, base.y - 64));
373 Sector::current()->trybreakbrick(
374 Vector(base.x+ 31, base.y), size == SMALL);
376 bumpbrick(base.x+ 31, base.y);
377 Sector::current()->tryemptybox(Vector(base.x+ 31, base.y), LEFT);
389 /* Make sure jumping is off. */
396 /* ---- DONE HANDLING TUX! --- */
399 skidding_timer.check();
400 invincible_timer.check();
408 return ( issolid(base.x + base.width / 2, base.y + base.height) ||
409 issolid(base.x + 1, base.y + base.height) ||
410 issolid(base.x + base.width - 1, base.y + base.height));
414 Player::under_solid()
416 return ( issolid(base.x + base.width / 2, base.y) ||
417 issolid(base.x + 1, base.y) ||
418 issolid(base.x + base.width - 1, base.y) );
422 Player::tiles_on_air(int tiles)
424 for(int t = 0; t != tiles; t++)
426 if(issolid(base.x + base.width / 2, base.y + base.height + (tiles*32)) ||
427 issolid(base.x + 1, base.y + base.height + (tiles*32)) ||
428 issolid(base.x + base.width - 1, base.y + base.height + (tiles*32)))
435 Player::handle_horizontal_input()
437 float vx = physic.get_velocity_x();
438 float vy = physic.get_velocity_y();
439 float ax = physic.get_acceleration_x();
440 float ay = physic.get_acceleration_y();
443 if(input.left == DOWN && input.right == UP && (!duck || physic.get_velocity_y() != 0)) {
447 } else if(input.left == UP && input.right == DOWN && (!duck || physic.get_velocity_y() != 0)) {
453 if (input.fire == UP) {
454 ax = dirsign * WALK_ACCELERATION_X;
456 if(vx >= MAX_WALK_XM && dirsign > 0) {
459 } else if(vx <= -MAX_WALK_XM && dirsign < 0) {
464 ax = dirsign * RUN_ACCELERATION_X;
466 if(vx >= MAX_RUN_XM && dirsign > 0) {
469 } else if(vx <= -MAX_RUN_XM && dirsign < 0) {
475 // we can reach WALK_SPEED without any acceleration
476 if(dirsign != 0 && fabs(vx) < WALK_SPEED) {
477 vx = dirsign * WALK_SPEED;
480 // changing directions?
481 if(on_ground() && ((vx < 0 && dirsign >0) || (vx>0 && dirsign<0))) {
482 if(fabs(vx)>SKID_XM && !skidding_timer.check()) {
483 skidding_timer.start(SKID_TIME);
484 SoundManager::get()->play_sound(IDToSound(SND_SKID));
491 // we get slower when not pressing any keys
493 if(fabs(vx) < WALK_SPEED) {
497 ax = WALK_ACCELERATION_X * 1.5;
499 ax = WALK_ACCELERATION_X * -1.5;
503 // if we're on ice slow down acceleration or deceleration
504 if (isice(base.x, base.y + base.height))
506 /* the acceleration/deceleration rate on ice is inversely proportional to
507 * the current velocity.
510 // increasing 1 will increase acceleration/deceleration rate
511 // decreasing 1 will decrease acceleration/deceleration rate
512 // must stay above zero, though
513 if (ax != 0) ax *= 1 / fabs(vx);
516 physic.set_velocity(vx, vy);
517 physic.set_acceleration(ax, ay);
521 Player::handle_vertical_input()
526 fall_mode = ON_GROUND;
527 last_ground_y = base.y;
529 if(base.y > last_ground_y)
531 else if(fall_mode == ON_GROUND)
536 if(input.up == DOWN && can_jump && on_ground())
538 if(duck) { // only jump a little bit when in duck mode {
539 physic.set_velocity_y(3);
541 // jump higher if we are running
542 if (fabs(physic.get_velocity_x()) > MAX_WALK_XM)
543 physic.set_velocity_y(5.8);
545 physic.set_velocity_y(5.2);
554 SoundManager::get()->play_sound(IDToSound(SND_JUMP));
556 SoundManager::get()->play_sound(IDToSound(SND_BIGJUMP));
558 // Let go of jump key
559 else if(input.up == UP)
561 if (!flapping && !duck && !falling_from_flap && !on_ground())
565 if (jumping && physic.get_velocity_y() > 0)
568 physic.set_velocity_y(0);
573 if (input.up == DOWN && can_flap)
575 if (!flapping_timer.started())
577 flapping_timer.start(TUX_FLAPPING_TIME);
579 if (!flapping_timer.check())
582 falling_from_flap = true;
584 if (physic.get_velocity_x() > 0) {physic.set_velocity_x(WALK_SPEED);}
585 else if (physic.get_velocity_x() < 0) {physic.set_velocity_x(WALK_SPEED * (-1));}
588 if (flapping_timer.get_gone() <= TUX_FLAPPING_TIME)
590 physic.set_velocity_y((float)flapping_timer.get_gone()/700);
595 //(disabled by default, use cheat code "hover" to toggle on/off)
596 //TODO: needs some tweaking, especially when used together with double jump and jumping off badguys
597 if (enable_hover && input.up == DOWN && !jumping && !butt_jump && physic.get_velocity_y() <= 0)
599 physic.set_velocity_y(-1);
602 /* In case the player has pressed Down while in a certain range of air,
603 enable butt jump action */
604 if (input.down == DOWN && !butt_jump && !duck)
605 if(tiles_on_air(TILES_FOR_BUTTJUMP) && jumping)
608 /* When Down is not held anymore, disable butt jump */
609 if(butt_jump && input.down == UP)
613 if (butt_jump && on_ground() && size == BIG)
617 Sector::current()->add_smoke_cloud(Vector(base.x - 32, base.y));
619 Sector::current()->add_smoke_cloud(Vector(base.x - 32, base.y + 32));
623 // Break bricks beneath Tux
624 if(Sector::current()->trybreakbrick(
625 Vector(base.x + 1, base.y + base.height), false)
626 || Sector::current()->trybreakbrick(
627 Vector(base.x + base.width - 1, base.y + base.height), false))
629 physic.set_velocity_y(2);
633 // Kill nearby badguys
634 std::vector<GameObject*> gameobjects = Sector::current()->gameobjects;
635 for (std::vector<GameObject*>::iterator i = gameobjects.begin();
636 i != gameobjects.end();
639 BadGuy* badguy = dynamic_cast<BadGuy*> (*i);
642 // don't kill when badguys are already dying or in a certain mode
643 if(badguy->dying == DYING_NOT && badguy->mode != BadGuy::BOMB_TICKING &&
644 badguy->mode != BadGuy::BOMB_EXPLODE)
646 if (fabsf(base.x - badguy->base.x) < 150 &&
647 fabsf(base.y - badguy->base.y) < 60 &&
648 (issolid(badguy->base.x + 1, badguy->base.y + badguy->base.height) ||
649 issolid(badguy->base.x + badguy->base.width - 1, badguy->base.y + badguy->base.height)))
656 if ( (issolid(base.x + base.width / 2, base.y + base.height + 64) ||
657 issolid(base.x + 1, base.y + base.height + 64) ||
658 issolid(base.x + base.width - 1, base.y + base.height + 64))
662 && input.old_up == UP)
667 if(on_ground()) /* Make sure jumping is off. */
671 falling_from_flap = false;
672 if (flapping_timer.started()) {flapping_timer.stop();}
675 input.old_up = input.up;
679 Player::handle_input()
681 /* Handle horizontal movement: */
682 handle_horizontal_input();
686 if (on_ground() && input.up == UP)
688 handle_vertical_input();
691 if (input.fire == DOWN && input.old_fire == UP && got_power != NONE_POWER)
693 if(Sector::current()->add_bullet(Vector(base.x, base.y + (base.height/2)),
694 physic.get_velocity_x(), dir))
695 shooting_timer.start(SHOOTING_TIME);
696 input.old_fire = DOWN;
699 /* tux animations: */
700 if(!frame_timer.check())
702 frame_timer.start(25);
703 if (input.right == UP && input.left == UP)
710 if ((input.fire == DOWN && (global_frame_counter % 2) == 0) ||
711 (global_frame_counter % 4) == 0)
712 frame_main = (frame_main + 1) % 4;
722 if (input.down == DOWN && size == BIG && !duck && physic.get_velocity_y() == 0 && on_ground())
727 // changing base size confuses collision otherwise
728 old_base = previous_base = base;
730 else if(input.down == UP && size == BIG && duck)
732 // try if we can really unduck
735 // when unducking in air we need some space to do so
736 if(on_ground() || !collision_object_map(base)) {
738 // changing base size confuses collision otherwise
739 old_base = previous_base = base;
741 // undo the ducking changes
749 Player::grow(bool animate)
759 growing_timer.start(GROWING_TIME);
761 old_base = previous_base = base;
765 Player::grabdistros()
770 Sector::current()->trygrabdistro(Vector(base.x, base.y), NO_BOUNCE);
771 Sector::current()->trygrabdistro(Vector(base.x+ 31, base.y), NO_BOUNCE);
772 Sector::current()->trygrabdistro(
773 Vector(base.x, base.y + base.height), NO_BOUNCE);
774 Sector::current()->trygrabdistro(
775 Vector(base.x+ 31, base.y + base.height), NO_BOUNCE);
779 Sector::current()->trygrabdistro(
780 Vector(base.x, base.y + base.height / 2), NO_BOUNCE);
781 Sector::current()->trygrabdistro(
782 Vector(base.x+ 31, base.y + base.height / 2), NO_BOUNCE);
787 /* Enough distros for a One-up? */
788 if (player_status.distros >= DISTROS_LIFEUP)
790 player_status.distros = player_status.distros - DISTROS_LIFEUP;
791 if(player_status.lives < MAX_LIVES)
792 ++player_status.lives;
793 /*We want to hear the sound even, if MAX_LIVES is reached*/
794 SoundManager::get()->play_sound(IDToSound(SND_LIFEUP));
799 Player::draw(DrawingContext& context)
801 TuxBodyParts* tux_body;
804 tux_body = small_tux;
805 else if (got_power == FIRE_POWER)
807 else if (got_power == ICE_POWER)
812 int layer = LAYER_OBJECTS - 1;
813 Vector pos = Vector(base.x, base.y);
815 /* Set Tux sprite action */
816 if (duck && size == BIG)
819 tux_body->set_action("duck-left");
821 tux_body->set_action("duck-right");
823 else if (skidding_timer.started())
826 tux_body->set_action("skid-left");
828 tux_body->set_action("skid-right");
830 else if (kick_timer.started())
833 tux_body->set_action("kick-left");
835 tux_body->set_action("kick-right");
840 tux_body->set_action("buttjump-left");
842 tux_body->set_action("buttjump-right");
844 else if (physic.get_velocity_y() != 0)
847 tux_body->set_action("jump-left");
849 tux_body->set_action("jump-right");
853 if (fabsf(physic.get_velocity_x()) < 1.0f) // standing
856 tux_body->set_action("stand-left");
858 tux_body->set_action("stand-right");
863 tux_body->set_action("walk-left");
865 tux_body->set_action("walk-right");
869 if(idle_timer.get_left() < 0)
874 tux_body->head->set_action("idle-left");
876 tux_body->head->set_action("idle-right");
878 tux_body->head->start_animation(1);
881 idle_timer.start(IDLE_TIME);
884 // Tux is holding something
885 if ((holding_something && physic.get_velocity_y() == 0) ||
886 shooting_timer.check())
891 tux_body->arms->set_action("duck+grab-left");
893 tux_body->arms->set_action("duck+grab-right");
898 tux_body->arms->set_action("grab-left");
900 tux_body->arms->set_action("grab-right");
905 if (dying == DYING_SQUISHED)
907 smalltux_gameover->draw(context, pos, LAYER_FOREGROUNDTILES+1);
909 else if(growing_timer.check())
914 context.draw_surface(growingtux_right[GROWING_FRAMES-1 -
915 ((growing_timer.get_gone() *
916 GROWING_FRAMES) / GROWING_TIME)], pos, layer);
918 context.draw_surface(growingtux_left[GROWING_FRAMES-1 -
919 ((growing_timer.get_gone() *
920 GROWING_FRAMES) / GROWING_TIME)], pos, layer);
925 context.draw_surface(growingtux_right[(growing_timer.get_gone() *
926 GROWING_FRAMES) / GROWING_TIME], pos, layer);
928 context.draw_surface(growingtux_left[(growing_timer.get_gone() *
929 GROWING_FRAMES) / GROWING_TIME], pos, layer);
932 else if (safe_timer.started() && global_frame_counter%2)
935 tux_body->draw(context, pos, layer, dir == LEFT ? HORIZONTAL_FLIP : NONE_EFFECT);
937 // Draw blinking star overlay
938 if (invincible_timer.started() &&
939 (invincible_timer.get_left() > TUX_INVINCIBLE_TIME_WARNING || global_frame_counter % 3)
942 if (size == SMALL || duck)
943 smalltux_star->draw(context, pos, LAYER_OBJECTS + 2);
945 bigtux_star->draw(context, pos, LAYER_OBJECTS + 2);
949 context.draw_filled_rect(Vector(base.x, base.y),
950 Vector(base.width, base.height), Color(75,75,75, 150), LAYER_OBJECTS+1);
954 Player::collision(const MovingObject& other, int collision_type)
957 (void) collision_type;
958 // will be implemented later
962 Player::collision(void* p_c_object, int c_object)
964 BadGuy* pbad_c = NULL;
965 Trampoline* ptramp_c = NULL;
966 FlyingPlatform* pplatform_c = NULL;
971 pbad_c = (BadGuy*) p_c_object;
973 /* Hurt player if he touches a badguy */
974 if (!pbad_c->dying && !dying &&
975 !safe_timer.started() &&
976 pbad_c->mode != BadGuy::HELD)
978 if (pbad_c->mode == BadGuy::FLAT && input.fire == DOWN
979 && !holding_something)
981 holding_something = true;
982 pbad_c->mode = BadGuy::HELD;
985 else if (pbad_c->mode == BadGuy::FLAT)
987 // Don't get hurt if we're kicking a flat badguy!
989 else if (pbad_c->mode == BadGuy::KICK)
991 /* Hurt if you get hit by kicked laptop: */
992 if (!invincible_timer.started())
999 else if (pbad_c->frozen_timer.check() && (pbad_c->kind == BAD_MRBOMB
1000 || pbad_c->kind == BAD_JUMPY || pbad_c->kind == BAD_FISH
1001 || pbad_c->kind == BAD_SPIKY))
1002 pbad_c->kill_me(20);
1005 if (!invincible_timer.started())
1011 pbad_c->kill_me(25);
1014 player_status.score_multiplier++;
1019 ptramp_c = (Trampoline*) p_c_object;
1021 // Pick up trampoline
1022 if (ptramp_c->mode != Trampoline::M_HELD && input.fire == DOWN && !holding_something && on_ground())
1024 holding_something = true;
1025 ptramp_c->mode = Trampoline::M_HELD;
1026 ptramp_c->base.y -= 8;
1028 // Set down trampoline
1029 else if (ptramp_c->mode == Trampoline::M_HELD && input.fire != DOWN)
1031 holding_something = false;
1032 ptramp_c->mode = Trampoline::M_NORMAL;
1033 ptramp_c->base.y += 8;
1034 ptramp_c->physic.set_velocity(physic.get_velocity_x(), physic.get_velocity_y());
1037 // ptramp_c->base.x = base.x + base.width+1;
1039 // ptramp_c->base.x = base.x - base.width-1;
1042 // Don't let tux walk through trampoline
1043 else if (ptramp_c->mode != Trampoline::M_HELD && on_ground())
1045 if (physic.get_velocity_x() > 0) // RIGHT
1047 physic.set_velocity_x(0);
1048 base.x = ptramp_c->base.x - base.width;
1050 else if (physic.get_velocity_x() < 0) // LEFT
1052 physic.set_velocity_x(0);
1053 base.x = ptramp_c->base.x + ptramp_c->base.width;
1058 case CO_FLYING_PLATFORM:
1059 pplatform_c = (FlyingPlatform*) p_c_object;
1061 base.y = pplatform_c->base.y - base.height;
1062 physic.set_velocity_x(pplatform_c->get_vel_x());
1064 physic.enable_gravity(false);
1066 fall_mode = ON_GROUND;
1078 Player::kill(HurtMode mode)
1083 SoundManager::get()->play_sound(IDToSound(SND_HURT));
1085 physic.set_velocity_x(0);
1087 if (mode == SHRINK && size == BIG)
1089 if (got_power != NONE_POWER)
1091 safe_timer.start(TUX_SAFE_TIME);
1092 got_power = NONE_POWER;
1096 growing_timer.start(GROWING_TIME);
1097 safe_timer.start(TUX_SAFE_TIME + GROWING_TIME);
1105 physic.enable_gravity(true);
1106 physic.set_acceleration(0, 0);
1107 physic.set_velocity(0, 7);
1108 --player_status.lives;
1109 dying = DYING_SQUISHED;
1110 dying_timer.start(3000);
1114 /* Remove Tux's power ups */
1116 Player::remove_powerups()
1118 got_power = NONE_POWER;
1124 Player::move(const Vector& vector)
1128 old_base = previous_base = base;
1132 Player::check_bounds(Camera* camera)
1134 /* Keep tux in bounds: */
1136 { // Lock Tux to the size of the level, so that he doesn't fall of
1141 /* Keep in-bounds, vertically: */
1142 if (base.y > Sector::current()->solids->get_height() * 32)
1148 bool adjust = false;
1149 // can happen if back scrolling is disabled
1150 if(base.x < camera->get_translation().x) {
1151 base.x = camera->get_translation().x;
1154 if(base.x >= camera->get_translation().x + screen->w - base.width) {
1155 base.x = camera->get_translation().x + screen->w - base.width;
1161 if(collision_object_map(base)) {
1169 Player::bounce(BadGuy* badguy)
1171 //Make sure we stopped flapping
1173 falling_from_flap = false;
1175 if(player_status.score_multiplier >= 5)
1178 // if (player_status.score_multiplier <= 4) {sprintf(str, _("Combo x%d"), player_status.score_multiplier);}
1179 if (player_status.score_multiplier == 5)
1180 sprintf(str, _("Good! x%d"), player_status.score_multiplier);
1181 else if (player_status.score_multiplier == 6)
1182 sprintf(str, _("Great! x%d"), player_status.score_multiplier);
1183 else if (player_status.score_multiplier == 7)
1184 sprintf(str, _("Awesome! x%d"), player_status.score_multiplier);
1185 else if (player_status.score_multiplier == 8)
1186 sprintf(str, _("Incredible! x%d"), player_status.score_multiplier);
1187 else if (player_status.score_multiplier == 9)
1188 sprintf(str, _("Godlike! ;-) x%d"), player_status.score_multiplier);
1190 sprintf(str, _("Unbelievable!! x%d"), player_status.score_multiplier);
1191 Sector::current()->add_floating_text(base, str);
1195 physic.set_velocity_y(5.2);
1197 physic.set_velocity_y(2);
1199 // Move the player a little bit above the badguy to avoid collision
1200 // between badguy and player directly after the bounce has happend
1201 base.y = badguy->base.y - base.height - 2;