[Super-tux-commit] supertux/src badguy.cpp,1.50,1.51 defines.h,1.24,1.25 player.cpp,1.67,1.68 player
Brought to you by:
wkendrick
From: Ricardo C. <rm...@us...> - 2004-04-26 14:40:27
|
Update of /cvsroot/super-tux/supertux/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26352/src Modified Files: badguy.cpp defines.h player.cpp player.h Log Message: Implemented kicking (as asked by Ingo). The kick timing can be changed in defines.h I've not tested it very well, but it doesn't seem to be working. Can anyone have a look? Index: player.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/player.cpp,v retrieving revision 1.67 retrieving revision 1.68 diff -u -d -r1.67 -r1.68 --- player.cpp 26 Apr 2004 13:13:51 -0000 1.67 +++ player.cpp 26 Apr 2004 14:40:17 -0000 1.68 @@ -92,6 +92,7 @@ skidding_timer.init(true); safe_timer.init(true); frame_timer.init(true); + kick_timer.init(true); physic.reset(); } @@ -264,6 +265,7 @@ skidding_timer.check(); invincible_timer.check(); safe_timer.check(); + kick_timer.check(); } bool @@ -522,6 +524,13 @@ else sprite->skid_left->draw(base.x - scroll_x, base.y); } + else if (kick_timer.started()) + { + if (dir == RIGHT) + sprite->kick_right->draw(base.x - scroll_x, base.y); + else + sprite->kick_left->draw(base.x - scroll_x, base.y); + } else if (physic.get_velocity_y() != 0) { if (dir == RIGHT) Index: player.h =================================================================== RCS file: /cvsroot/super-tux/supertux/src/player.h,v retrieving revision 1.42 retrieving revision 1.43 diff -u -d -r1.42 -r1.43 --- player.h 25 Apr 2004 16:46:55 -0000 1.42 +++ player.h 26 Apr 2004 14:40:17 -0000 1.43 @@ -127,6 +127,7 @@ Timer skidding_timer; Timer safe_timer; Timer frame_timer; + Timer kick_timer; Physic physic; public: Index: defines.h =================================================================== RCS file: /cvsroot/super-tux/supertux/src/defines.h,v retrieving revision 1.24 retrieving revision 1.25 diff -u -d -r1.24 -r1.25 --- defines.h 25 Apr 2004 21:55:39 -0000 1.24 +++ defines.h 26 Apr 2004 14:40:17 -0000 1.25 @@ -85,6 +85,10 @@ #define LEVEL_WIDTH 375 +/* Timing constants (in ms): */ + +#define KICKING_TIME 3000 + /* Debugging */ Index: badguy.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/badguy.cpp,v retrieving revision 1.50 retrieving revision 1.51 diff -u -d -r1.50 -r1.51 --- badguy.cpp 26 Apr 2004 12:21:22 -0000 1.50 +++ badguy.cpp 26 Apr 2004 14:40:17 -0000 1.51 @@ -291,6 +291,7 @@ old_base = base; mode=KICK; + tux.kick_timer.start(KICKING_TIME); set_sprite(img_laptop_flat_left, img_laptop_flat_right); physic.set_velocity_x((dir == LEFT) ? -3.5 : 3.5); play_sound(sounds[SND_KICK],SOUND_CENTER_SPEAKER); |