4 // Copyright (C) 2000 Bill Kendrick <bill@newbreedsoftware.com>
5 // Copyright (C) 2004 Tobias Glaesser <tobi.web@gmx.de>
6 // Copyright (C) 2004 Matthias Braun <matze@braunis.de>
8 // This program is free software; you can redistribute it and/or
9 // modify it under the terms of the GNU General Public License
10 // as published by the Free Software Foundation; either version 2
11 // of the License, or (at your option) any later version.
13 // This program is distributed in the hope that it will be useful,
14 // but WITHOUT ANY WARRANTY; without even the implied warranty of
15 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 // GNU General Public License for more details.
18 // You should have received a copy of the GNU General Public License
19 // along with this program; if not, write to the Free Software
20 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
33 #include "resources.h"
34 #include "sprite_manager.h"
36 Sprite* img_mriceblock_flat_left;
37 Sprite* img_mriceblock_flat_right;
38 Sprite* img_mriceblock_falling_left;
39 Sprite* img_mriceblock_falling_right;
40 Sprite* img_mriceblock_left;
41 Sprite* img_mriceblock_right;
42 Sprite* img_jumpy_left_up;
43 Sprite* img_jumpy_left_down;
44 Sprite* img_jumpy_left_middle;
45 Sprite* img_mrbomb_left;
46 Sprite* img_mrbomb_right;
47 Sprite* img_mrbomb_ticking_left;
48 Sprite* img_mrbomb_ticking_right;
49 Sprite* img_mrbomb_explosion;
50 Sprite* img_stalactite;
51 Sprite* img_stalactite_broken;
54 Sprite* img_fish_down;
55 Sprite* img_bouncingsnowball_left;
56 Sprite* img_bouncingsnowball_right;
57 Sprite* img_bouncingsnowball_squished;
58 Sprite* img_flyingsnowball;
59 Sprite* img_flyingsnowball_squished;
60 Sprite* img_spiky_left;
61 Sprite* img_spiky_right;
62 Sprite* img_snowball_left;
63 Sprite* img_snowball_right;
64 Sprite* img_snowball_squished_left;
65 Sprite* img_snowball_squished_right;
67 #define BADGUY_WALK_SPEED .8f
69 BadGuyKind badguykind_from_string(const std::string& str)
71 if (str == "money" || str == "jumpy") // was money in old maps
73 else if (str == "laptop" || str == "mriceblock") // was laptop in old maps
74 return BAD_MRICEBLOCK;
75 else if (str == "mrbomb")
77 else if (str == "stalactite")
78 return BAD_STALACTITE;
79 else if (str == "flame")
81 else if (str == "fish")
83 else if (str == "bouncingsnowball")
84 return BAD_BOUNCINGSNOWBALL;
85 else if (str == "flyingsnowball")
86 return BAD_FLYINGSNOWBALL;
87 else if (str == "spiky")
89 else if (str == "snowball" || str == "bsod") // was bsod in old maps
93 printf("Couldn't convert badguy: '%s'\n", str.c_str());
98 std::string badguykind_to_string(BadGuyKind kind)
120 case BAD_BOUNCINGSNOWBALL:
121 return "bouncingsnowball";
123 case BAD_FLYINGSNOWBALL:
124 return "flyingsnowball";
137 BadGuy::BadGuy(float x, float y, BadGuyKind kind_, bool stay_on_platform_)
138 : removable(false), squishcount(0)
147 stay_on_platform = stay_on_platform_;
154 animation_offset = 0;
155 sprite_left = sprite_right = 0;
159 if(kind == BAD_MRBOMB) {
160 physic.set_velocity(-BADGUY_WALK_SPEED, 0);
161 set_sprite(img_mrbomb_left, img_mrbomb_right);
162 } else if (kind == BAD_MRICEBLOCK) {
163 physic.set_velocity(-BADGUY_WALK_SPEED, 0);
164 set_sprite(img_mriceblock_left, img_mriceblock_right);
165 } else if(kind == BAD_JUMPY) {
166 set_sprite(img_jumpy_left_up, img_jumpy_left_up);
167 } else if(kind == BAD_BOMB) {
168 set_sprite(img_mrbomb_ticking_left, img_mrbomb_ticking_right);
169 // hack so that the bomb doesn't hurt until it expldes...
170 dying = DYING_SQUISHED;
171 } else if(kind == BAD_FLAME) {
172 base.ym = 0; // we misuse base.ym as angle for the flame
173 physic.enable_gravity(false);
174 set_sprite(img_flame, img_flame);
175 } else if(kind == BAD_BOUNCINGSNOWBALL) {
176 physic.set_velocity(-1.3, 0);
177 set_sprite(img_bouncingsnowball_left, img_bouncingsnowball_right);
178 } else if(kind == BAD_STALACTITE) {
179 physic.enable_gravity(false);
180 set_sprite(img_stalactite, img_stalactite);
181 } else if(kind == BAD_FISH) {
182 set_sprite(img_fish, img_fish);
183 physic.enable_gravity(true);
184 } else if(kind == BAD_FLYINGSNOWBALL) {
185 set_sprite(img_flyingsnowball, img_flyingsnowball);
186 physic.enable_gravity(false);
187 } else if(kind == BAD_SPIKY) {
188 physic.set_velocity(-BADGUY_WALK_SPEED, 0);
189 set_sprite(img_spiky_left, img_spiky_right);
190 } else if(kind == BAD_SNOWBALL) {
191 physic.set_velocity(-BADGUY_WALK_SPEED, 0);
192 set_sprite(img_snowball_left, img_snowball_right);
195 // if we're in a solid tile at start correct that now
196 if(kind != BAD_FLAME && kind != BAD_FISH && collision_object_map(base))
198 std::cout << "Warning: badguy started in wall: kind: " << badguykind_to_string(kind)
199 << " pos: (" << base.x << ", " << base.y << ")" << std::endl;
200 while(collision_object_map(base))
206 BadGuy::action_mriceblock(double frame_ratio)
208 Player& tux = *World::current()->get_tux();
213 /* Move left/right: */
217 physic.apply(frame_ratio, base.x, base.y);
218 if (dying != DYING_FALLING)
219 collision_swept_object_map(&old_base,&base);
221 else if (mode == HELD)
222 { /* FIXME: The pbad object shouldn't know about pplayer objects. */
223 /* If we're holding the iceblock */
227 base.x = tux.base.x + 16;
228 base.y = tux.base.y + tux.base.height/1.5 - base.height;
230 else /* facing left */
232 base.x = tux.base.x - 16;
233 base.y = tux.base.y + tux.base.height/1.5 - base.height;
235 if(collision_object_map(base))
238 base.y = tux.base.y + tux.base.height/1.5 - base.height;
241 if(tux.input.fire != DOWN) /* SHOOT! */
250 tux.kick_timer.start(KICKING_TIME);
251 set_sprite(img_mriceblock_flat_left, img_mriceblock_flat_right);
252 physic.set_velocity_x((dir == LEFT) ? -3.5 : 3.5);
253 play_sound(sounds[SND_KICK],SOUND_CENTER_SPEAKER);
260 check_horizontal_bump();
261 if(mode == KICK && changed != dir)
263 /* handle stereo sound (number 10 should be tweaked...)*/
264 if (base.x < scroll_x + screen->w/2 - 10)
265 play_sound(sounds[SND_RICOCHET], SOUND_LEFT_SPEAKER);
266 else if (base.x > scroll_x + screen->w/2 + 10)
267 play_sound(sounds[SND_RICOCHET], SOUND_RIGHT_SPEAKER);
269 play_sound(sounds[SND_RICOCHET], SOUND_CENTER_SPEAKER);
273 /* Handle mode timer: */
279 set_sprite(img_mriceblock_left, img_mriceblock_right);
280 physic.set_velocity( (dir == LEFT) ? -.8 : .8, 0);
286 BadGuy::check_horizontal_bump(bool checkcliff)
288 float halfheight = base.height / 2;
289 if (dir == LEFT && issolid( base.x, (int) base.y + halfheight))
292 physic.set_velocity(-physic.get_velocity_x(), physic.get_velocity_y());
295 if (dir == RIGHT && issolid( base.x + base.width, (int)base.y + halfheight))
298 physic.set_velocity(-physic.get_velocity_x(), physic.get_velocity_y());
302 // don't check for cliffs when we're falling
305 if(!issolid(base.x + base.width/2, base.y + base.height))
308 if(dir == LEFT && !issolid(base.x, (int) base.y + base.height + halfheight))
311 physic.set_velocity(-physic.get_velocity_x(), physic.get_velocity_y());
314 if(dir == RIGHT && !issolid(base.x + base.width,
315 (int) base.y + base.height + halfheight))
318 physic.set_velocity(-physic.get_velocity_x(), physic.get_velocity_y());
326 /* Fall if we get off the ground: */
327 if (dying != DYING_FALLING)
329 if (!issolid(base.x+base.width/2, base.y + base.height))
331 // not solid below us? enable gravity
332 physic.enable_gravity(true);
337 if (physic.get_velocity_y() < 0)
339 base.y = int((base.y + base.height)/32) * 32 - base.height;
340 physic.set_velocity_y(0);
342 // no gravity anymore please
343 physic.enable_gravity(false);
345 if (stay_on_platform && mode == NORMAL)
347 if (!issolid(base.x + ((dir == LEFT) ? 0 : base.width),
348 base.y + base.height))
353 physic.set_velocity_x(fabs(physic.get_velocity_x()));
358 physic.set_velocity_x(-fabs(physic.get_velocity_x()));
366 physic.enable_gravity(true);
377 BadGuy::action_jumpy(double frame_ratio)
379 if (fabsf(physic.get_velocity_y()) < 2.5f)
380 set_sprite(img_jumpy_left_middle, img_jumpy_left_middle);
381 else if (physic.get_velocity_y() < 0)
382 set_sprite(img_jumpy_left_up, img_jumpy_left_up);
384 set_sprite(img_jumpy_left_down, img_jumpy_left_down);
386 Player& tux = *World::current()->get_tux();
388 static const float JUMPV = 6;
391 // jump when on ground
392 if(dying == DYING_NOT && issolid(base.x, base.y+32))
394 physic.set_velocity_y(JUMPV);
395 physic.enable_gravity(true);
399 else if(mode == JUMPY_JUMP)
404 // set direction based on tux
405 if(tux.base.x > base.x)
411 physic.apply(frame_ratio, base.x, base.y);
412 if(dying == DYING_NOT)
413 collision_swept_object_map(&old_base, &base);
417 BadGuy::action_mrbomb(double frame_ratio)
419 if (dying == DYING_NOT)
420 check_horizontal_bump(true);
424 physic.apply(frame_ratio, base.x, base.y);
425 if (dying != DYING_FALLING)
426 collision_swept_object_map(&old_base,&base);
430 BadGuy::action_bomb(double frame_ratio)
432 static const int TICKINGTIME = 1000;
433 static const int EXPLODETIME = 1000;
439 timer.start(TICKINGTIME);
440 } else if(!timer.check()) {
441 if(mode == BOMB_TICKING) {
443 set_sprite(img_mrbomb_explosion, img_mrbomb_explosion);
444 dying = DYING_NOT; // now the bomb hurts
445 timer.start(EXPLODETIME);
447 /* play explosion sound */ // FIXME: is the stereo all right? maybe we should use player cordinates...
448 if (base.x < scroll_x + screen->w/2 - 10)
449 play_sound(sounds[SND_EXPLODE], SOUND_LEFT_SPEAKER);
450 else if (base.x > scroll_x + screen->w/2 + 10)
451 play_sound(sounds[SND_EXPLODE], SOUND_RIGHT_SPEAKER);
453 play_sound(sounds[SND_EXPLODE], SOUND_CENTER_SPEAKER);
455 } else if(mode == BOMB_EXPLODE) {
462 physic.apply(frame_ratio, base.x, base.y);
463 collision_swept_object_map(&old_base,&base);
467 BadGuy::action_stalactite(double frame_ratio)
469 Player& tux = *World::current()->get_tux();
471 static const int SHAKETIME = 800;
472 static const int RANGE = 40;
475 // start shaking when tux is below the stalactite and at least 40 pixels
477 if(tux.base.x + 32 > base.x - RANGE && tux.base.x < base.x + 32 + RANGE
478 && tux.base.y + tux.base.height > base.y) {
479 timer.start(SHAKETIME);
480 mode = STALACTITE_SHAKING;
482 } if(mode == STALACTITE_SHAKING) {
483 base.x = old_base.x + (rand() % 6) - 3; // TODO this could be done nicer...
485 mode = STALACTITE_FALL;
487 } else if(mode == STALACTITE_FALL) {
489 /* Destroy if we collides with land */
490 if(issolid(base.x+base.width/2, base.y+base.height))
493 dying = DYING_SQUISHED;
495 set_sprite(img_stalactite_broken, img_stalactite_broken);
497 } else if(mode == FLAT) {
502 physic.apply(frame_ratio, base.x, base.y);
504 if(dying == DYING_SQUISHED && !timer.check())
509 BadGuy::action_flame(double frame_ratio)
511 static const float radius = 100;
512 static const float speed = 0.02;
513 base.x = old_base.x + cos(base.ym) * radius;
514 base.y = old_base.y + sin(base.ym) * radius;
516 base.ym = fmodf(base.ym + frame_ratio * speed, 2*M_PI);
520 BadGuy::action_fish(double frame_ratio)
522 static const float JUMPV = 6;
523 static const int WAITTIME = 1000;
525 // go in wait mode when back in water
526 if(dying == DYING_NOT && gettile(base.x, base.y+ base.height)->water
527 && physic.get_velocity_y() <= 0 && mode == NORMAL)
531 physic.set_velocity(0, 0);
532 physic.enable_gravity(false);
533 timer.start(WAITTIME);
535 else if(mode == FISH_WAIT && !timer.check())
538 set_sprite(img_fish, img_fish);
540 physic.set_velocity(0, JUMPV);
541 physic.enable_gravity(true);
544 physic.apply(frame_ratio, base.x, base.y);
545 if(dying == DYING_NOT)
546 collision_swept_object_map(&old_base, &base);
548 if(physic.get_velocity_y() < 0)
549 set_sprite(img_fish_down, img_fish_down);
553 BadGuy::action_bouncingsnowball(double frame_ratio)
555 static const float JUMPV = 4.5;
559 // jump when on ground
560 if(dying == DYING_NOT && issolid(base.x, base.y+32))
562 physic.set_velocity_y(JUMPV);
563 physic.enable_gravity(true);
570 // check for right/left collisions
571 check_horizontal_bump();
573 physic.apply(frame_ratio, base.x, base.y);
574 if(dying == DYING_NOT)
575 collision_swept_object_map(&old_base, &base);
577 // Handle dying timer:
578 if (dying == DYING_SQUISHED && !timer.check())
580 /* Remove it if time's up: */
587 BadGuy::action_flyingsnowball(double frame_ratio)
589 static const float FLYINGSPEED = 1;
590 static const int DIRCHANGETIME = 1000;
592 // go into flyup mode if none specified yet
593 if(dying == DYING_NOT && mode == NORMAL) {
595 physic.set_velocity_y(FLYINGSPEED);
596 timer.start(DIRCHANGETIME/2);
599 if(dying == DYING_NOT && !timer.check()) {
602 physic.set_velocity_y(-FLYINGSPEED);
603 } else if(mode == FLY_DOWN) {
605 physic.set_velocity_y(FLYINGSPEED);
607 timer.start(DIRCHANGETIME);
610 if(dying != DYING_NOT)
611 physic.enable_gravity(true);
613 physic.apply(frame_ratio, base.x, base.y);
614 if(dying == DYING_NOT || dying == DYING_SQUISHED)
615 collision_swept_object_map(&old_base, &base);
617 // Handle dying timer:
618 if (dying == DYING_SQUISHED && !timer.check())
620 /* Remove it if time's up: */
627 BadGuy::action_spiky(double frame_ratio)
629 if (dying == DYING_NOT)
630 check_horizontal_bump();
634 // jump when we're about to fall
635 if (physic.get_velocity_y() == 0 &&
636 !issolid(base.x+base.width/2, base.y + base.height)) {
637 physic.enable_gravity(true);
638 physic.set_velocity_y(2);
642 physic.apply(frame_ratio, base.x, base.y);
643 if (dying != DYING_FALLING)
644 collision_swept_object_map(&old_base,&base);
648 BadGuy::action_snowball(double frame_ratio)
650 if (dying == DYING_NOT)
651 check_horizontal_bump();
655 physic.apply(frame_ratio, base.x, base.y);
656 if (dying != DYING_FALLING)
657 collision_swept_object_map(&old_base,&base);
661 BadGuy::action(double frame_ratio)
663 // Remove if it's far off the screen:
664 if (base.x < scroll_x - OFFSCREEN_DISTANCE)
670 // BadGuy fall below the ground
671 if (base.y > screen->h) {
676 // Once it's on screen, it's activated!
677 if (base.x <= scroll_x + screen->w + OFFSCREEN_DISTANCE)
686 action_mriceblock(frame_ratio);
690 action_jumpy(frame_ratio);
694 action_mrbomb(frame_ratio);
698 action_bomb(frame_ratio);
702 action_stalactite(frame_ratio);
706 action_flame(frame_ratio);
710 action_fish(frame_ratio);
713 case BAD_BOUNCINGSNOWBALL:
714 action_bouncingsnowball(frame_ratio);
717 case BAD_FLYINGSNOWBALL:
718 action_flyingsnowball(frame_ratio);
722 action_spiky(frame_ratio);
726 action_snowball(frame_ratio);
736 // Don't try to draw stuff that is outside of the screen
737 if(base.x <= scroll_x - base.width || base.x >= scroll_x + screen->w)
740 if(sprite_left == 0 || sprite_right == 0)
745 Sprite* sprite = (dir == LEFT) ? sprite_left : sprite_right;
746 sprite->draw(base.x - scroll_x, base.y);
749 fillrect(base.x - scroll_x, base.y, base.width, base.height, 75,0,75, 150);
753 BadGuy::set_sprite(Sprite* left, Sprite* right)
762 // FIXME: Using the image size for the physics and collision is
763 // a bad idea, since images should always overlap there physical
766 if(base.width == 0 && base.height == 0) {
767 base.width = left->get_width();
768 base.height = left->get_height();
769 } else if(base.width != left->get_width() || base.height != left->get_height()) {
770 base.x -= (left->get_width() - base.width) / 2;
771 base.y -= left->get_height() - base.height;
772 base.width = left->get_width();
773 base.height = left->get_height();
777 base.width = base.height = 0;
781 animation_offset = 0;
783 sprite_right = right;
789 // these can't be bumped
790 if(kind == BAD_FLAME || kind == BAD_BOMB || kind == BAD_FISH
791 || kind == BAD_FLYINGSNOWBALL)
794 physic.set_velocity_y(3);
799 BadGuy::make_player_jump(Player* player)
801 player->physic.set_velocity_y(2);
802 player->base.y = base.y - player->base.height - 2;
806 BadGuy::squish_me(Player* player)
808 make_player_jump(player);
810 World::current()->add_score(base.x - scroll_x,
811 base.y, 50 * player_status.score_multiplier);
812 play_sound(sounds[SND_SQUISH], SOUND_CENTER_SPEAKER);
813 player_status.score_multiplier++;
815 dying = DYING_SQUISHED;
817 physic.set_velocity(0, 0);
821 BadGuy::squish(Player* player)
823 static const int MAX_ICEBLOCK_SQUICHES = 10;
825 if(kind == BAD_MRBOMB) {
826 // mrbomb transforms into a bomb now
827 World::current()->add_bad_guy(base.x, base.y, BAD_BOMB);
829 make_player_jump(player);
830 World::current()->add_score(base.x - scroll_x, base.y, 50 * player_status.score_multiplier);
831 play_sound(sounds[SND_SQUISH], SOUND_CENTER_SPEAKER);
832 player_status.score_multiplier++;
836 } else if (kind == BAD_MRICEBLOCK) {
837 if (mode == NORMAL || mode == KICK)
840 play_sound(sounds[SND_STOMP], SOUND_CENTER_SPEAKER);
842 set_sprite(img_mriceblock_flat_left, img_mriceblock_flat_right);
843 physic.set_velocity_x(0);
846 } else if (mode == FLAT) {
848 play_sound(sounds[SND_KICK], SOUND_CENTER_SPEAKER);
850 if (player->base.x < base.x + (base.width/2)) {
851 physic.set_velocity_x(5);
854 physic.set_velocity_x(-5);
859 player->kick_timer.start(KICKING_TIME);
860 set_sprite(img_mriceblock_flat_left, img_mriceblock_flat_right);
863 make_player_jump(player);
865 player_status.score_multiplier++;
867 // check for maximum number of squiches
869 if(squishcount >= MAX_ICEBLOCK_SQUICHES) {
875 } else if(kind == BAD_FISH) {
876 // fish can only be killed when falling down
877 if(physic.get_velocity_y() >= 0)
880 make_player_jump(player);
882 World::current()->add_score(base.x - scroll_x, base.y, 25 * player_status.score_multiplier);
883 player_status.score_multiplier++;
885 // simply remove the fish...
888 } else if(kind == BAD_BOUNCINGSNOWBALL) {
890 set_sprite(img_bouncingsnowball_squished,img_bouncingsnowball_squished);
892 } else if(kind == BAD_FLYINGSNOWBALL) {
894 set_sprite(img_flyingsnowball_squished,img_flyingsnowball_squished);
896 } else if(kind == BAD_SNOWBALL) {
898 set_sprite(img_snowball_squished_left, img_snowball_squished_right);
904 BadGuy::kill_me(int score)
906 if(kind == BAD_BOMB || kind == BAD_STALACTITE || kind == BAD_FLAME)
909 dying = DYING_FALLING;
910 if(kind == BAD_MRICEBLOCK) {
911 set_sprite(img_mriceblock_falling_left, img_mriceblock_falling_right);
914 Player& tux = *World::current()->get_tux();
915 tux.holding_something = false;
919 physic.enable_gravity(true);
921 /* Gain some points: */
922 World::current()->add_score(base.x - scroll_x, base.y,
923 score * player_status.score_multiplier);
925 /* Play death sound: */
926 play_sound(sounds[SND_FALL], SOUND_CENTER_SPEAKER);
930 BadGuy::collision(void *p_c_object, int c_object, CollisionType type)
932 BadGuy* pbad_c = NULL;
934 if(type == COLLISION_BUMP) {
939 if(type == COLLISION_SQUISH) {
940 Player* player = static_cast<Player*>(p_c_object);
945 /* COLLISION_NORMAL */
953 pbad_c = (BadGuy*) p_c_object;
955 /* If we're a kicked mriceblock, kill any badguys we hit */
956 if(kind == BAD_MRICEBLOCK && mode == KICK)
961 // a held mriceblock gets kills the enemy too but falls to ground then
962 else if(kind == BAD_MRICEBLOCK && mode == HELD)
968 /* Kill badguys that run into exploding bomb */
969 else if (kind == BAD_BOMB && dying == DYING_NOT)
971 if (pbad_c->kind == BAD_MRBOMB)
973 // mrbomb transforms into a bomb now
974 World::current()->add_bad_guy(pbad_c->base.x, pbad_c->base.y,
979 else if (pbad_c->kind != BAD_MRBOMB)
985 /* Kill any badguys that get hit by stalactite */
986 else if (kind == BAD_STALACTITE && dying == DYING_NOT)
991 /* When enemies run into eachother, make them change directions */
994 // Jumpy, fish, flame, stalactites are exceptions
995 if (pbad_c->kind == BAD_JUMPY || pbad_c->kind == BAD_FLAME
996 || pbad_c->kind == BAD_STALACTITE || pbad_c->kind == BAD_FISH)
999 // Bounce off of other badguy if we land on top of him
1000 if (base.y + base.height < pbad_c->base.y + pbad_c->base.height)
1002 if (pbad_c->dir == LEFT)
1005 physic.set_velocity(fabs(physic.get_velocity_x()), 2);
1007 else if (pbad_c->dir == RIGHT)
1010 physic.set_velocity(-fabs(physic.get_velocity_x()), 2);
1017 else if (base.y + base.height > pbad_c->base.y + pbad_c->base.height)
1020 if (pbad_c->kind != BAD_FLAME)
1025 physic.set_velocity_x(fabs(physic.get_velocity_x()));
1027 else if (dir == RIGHT)
1030 physic.set_velocity_x(-fabs(physic.get_velocity_x()));
1039 Player* player = static_cast<Player*>(p_c_object);
1040 /* Get kicked if were flat */
1041 if (mode == FLAT && !dying)
1043 play_sound(sounds[SND_KICK], SOUND_CENTER_SPEAKER);
1045 // Hit from left side
1046 if (player->base.x < base.x) {
1047 physic.set_velocity_x(5);
1050 // Hit from right side
1052 physic.set_velocity_x(-5);
1057 player->kick_timer.start(KICKING_TIME);
1058 set_sprite(img_mriceblock_flat_left, img_mriceblock_flat_right);
1065 //---------------------------------------------------------------------------
1067 void load_badguy_gfx()
1069 img_mriceblock_flat_left = sprite_manager->load("mriceblock-flat-left");
1070 img_mriceblock_flat_right = sprite_manager->load("mriceblock-flat-right");
1071 img_mriceblock_falling_left = sprite_manager->load("mriceblock-falling-left");
1072 img_mriceblock_falling_right = sprite_manager->load("mriceblock-falling-right");
1073 img_mriceblock_left = sprite_manager->load("mriceblock-left");
1074 img_mriceblock_right = sprite_manager->load("mriceblock-right");
1075 img_jumpy_left_up = sprite_manager->load("jumpy-left-up");
1076 img_jumpy_left_down = sprite_manager->load("jumpy-left-down");
1077 img_jumpy_left_middle = sprite_manager->load("jumpy-left-middle");
1078 img_mrbomb_left = sprite_manager->load("mrbomb-left");
1079 img_mrbomb_right = sprite_manager->load("mrbomb-right");
1080 img_mrbomb_ticking_left = sprite_manager->load("mrbomb-ticking-left");
1081 img_mrbomb_ticking_right = sprite_manager->load("mrbomb-ticking-right");
1082 img_mrbomb_explosion = sprite_manager->load("mrbomb-explosion");
1083 img_stalactite = sprite_manager->load("stalactite");
1084 img_stalactite_broken = sprite_manager->load("stalactite-broken");
1085 img_flame = sprite_manager->load("flame");
1086 img_fish = sprite_manager->load("fish");
1087 img_fish_down = sprite_manager->load("fish-down");
1088 img_bouncingsnowball_left = sprite_manager->load("bouncingsnowball-left");
1089 img_bouncingsnowball_right = sprite_manager->load("bouncingsnowball-right");
1090 img_bouncingsnowball_squished = sprite_manager->load("bouncingsnowball-squished");
1091 img_flyingsnowball = sprite_manager->load("flyingsnowball");
1092 img_flyingsnowball_squished = sprite_manager->load("flyingsnowball-squished");
1093 img_spiky_left = sprite_manager->load("spiky-left");
1094 img_spiky_right = sprite_manager->load("spiky-right");
1095 img_snowball_left = sprite_manager->load("snowball-left");
1096 img_snowball_right = sprite_manager->load("snowball-right");
1097 img_snowball_squished_left = sprite_manager->load("snowball-squished-left");
1098 img_snowball_squished_right = sprite_manager->load("snowball-squished-right");
1101 void free_badguy_gfx()