[Super-tux-commit] supertux/src badguy.cpp,1.36,1.37 player.cpp,1.39,1.40 world.cpp,1.27,1.28
Brought to you by:
wkendrick
From: Ricardo C. <rm...@us...> - 2004-04-18 11:10:04
|
Update of /cvsroot/super-tux/supertux/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9573/src Modified Files: badguy.cpp player.cpp world.cpp Log Message: Patch by Ryan: « Here's a patch that makes a few changes that makes ST more like SMB. Changes include: * Kicked mriceblocks (laptops) don't die after hitting a single enemy, they keep going to kill more badguys (or Tux if you're not careful) * You can now kick mriceblocks (laptops) by running into their sides. Before you had to jump on them to "kick" them and if you walked into their sides you would die (or shrink). * When badguys walk into one another they turn around instead of walking through eachother. » Index: player.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/player.cpp,v retrieving revision 1.39 retrieving revision 1.40 diff -u -d -r1.39 -r1.40 --- player.cpp 17 Apr 2004 13:56:47 -0000 1.39 +++ player.cpp 18 Apr 2004 11:09:55 -0000 1.40 @@ -726,8 +726,8 @@ { case CO_BADGUY: pbad_c = (BadGuy*) p_c_object; - /* Hurt the player if he just touched it: */ + /* Hurt player if he touches a badguy */ if (!pbad_c->dying && !dying && !safe_timer.started() && pbad_c->mode != HELD) @@ -737,30 +737,24 @@ pbad_c->mode = HELD; pbad_c->base.y-=8; } + else if (pbad_c->mode == FLAT) + { + // Don't get hurt if we're kicking a flat badguy! + } else if (pbad_c->mode == KICK) { - if (base.y < pbad_c->base.y - 16) + /* Hurt if you get hit by kicked laptop: */ + if (!invincible_timer.started()) { - /* Step on (stop being kicked) */ - - pbad_c->mode = FLAT; - play_sound(sounds[SND_STOMP], SOUND_CENTER_SPEAKER); + kill(SHRINK); } else { - /* Hurt if you get hit by kicked laptop: */ - if (!invincible_timer.started()) - { - kill(SHRINK); - } - else - { - pbad_c->dying = DYING_FALLING; - play_sound(sounds[SND_FALL], SOUND_CENTER_SPEAKER); - World::current()->add_score(pbad_c->base.x - scroll_x, - pbad_c->base.y, - 25 * player_status.score_multiplier); - } + pbad_c->dying = DYING_FALLING; + play_sound(sounds[SND_FALL], SOUND_CENTER_SPEAKER); + World::current()->add_score(pbad_c->base.x - scroll_x, + pbad_c->base.y, + 25 * player_status.score_multiplier); } } else Index: badguy.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/badguy.cpp,v retrieving revision 1.36 retrieving revision 1.37 diff -u -d -r1.36 -r1.37 --- badguy.cpp 17 Apr 2004 12:00:31 -0000 1.36 +++ badguy.cpp 18 Apr 2004 11:09:55 -0000 1.37 @@ -957,6 +957,7 @@ return; } + /* COLLISION_NORMAL */ switch (c_object) { case CO_BULLET: @@ -965,13 +966,12 @@ case CO_BADGUY: pbad_c = (BadGuy*) p_c_object; + + /* If we're a kicked mriceblock, kill any badguys we hit */ if(kind == BAD_LAPTOP && mode == KICK && pbad_c->kind != BAD_FLAME && pbad_c->kind != BAD_BOMB) { - /* We're in kick mode, kill the other guy - and yourself(wuahaha) : */ pbad_c->kill_me(); - kill_me(); } /* Kill badguys that run into exploding bomb */ @@ -993,8 +993,46 @@ { pbad_c->kill_me(); } + + /* When enemies run into eachother, make them change directions */ + else + { + // Jumpy is an exception + if (pbad_c->kind == BAD_MONEY) + break; + if (dir == LEFT) + dir = RIGHT; + else if (dir == RIGHT) + dir = LEFT; + + physic.inverse_velocity_x(); + } break; + + case CO_PLAYER: + Player* player = static_cast<Player*>(p_c_object); + /* Get kicked if were flat */ + if (mode == FLAT && !dying) + { + play_sound(sounds[SND_KICK], SOUND_CENTER_SPEAKER); + + // Hit from left side + if (player->base.x < base.x) { + physic.set_velocity(5, physic.get_velocity_y()); + dir = RIGHT; + } + // Hit from right side + else { + physic.set_velocity(-5, physic.get_velocity_y()); + dir = LEFT; + } + + mode = KICK; + set_sprite(img_laptop_flat_left, img_laptop_flat_right, 1); + } + break; + } } Index: world.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/world.cpp,v retrieving revision 1.27 retrieving revision 1.28 diff -u -d -r1.27 -r1.28 --- world.cpp 17 Apr 2004 13:56:48 -0000 1.27 +++ world.cpp 18 Apr 2004 11:09:55 -0000 1.28 @@ -315,6 +315,7 @@ else { tux.collision(&bad_guys[i], CO_BADGUY); + bad_guys[i].collision(&tux, CO_PLAYER, COLLISION_NORMAL); } } } |