[Super-tux-commit] supertux/src gameobjs.cpp,1.20,1.21 gameobjs.h,1.13,1.14
Brought to you by:
wkendrick
From: Ryan F. <sik...@us...> - 2004-05-16 16:49:22
|
Update of /cvsroot/super-tux/supertux/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5337 Modified Files: gameobjs.cpp gameobjs.h Log Message: - trampoline stuff Index: gameobjs.h =================================================================== RCS file: /cvsroot/super-tux/supertux/src/gameobjs.h,v retrieving revision 1.13 retrieving revision 1.14 diff -u -d -r1.13 -r1.14 --- gameobjs.h 16 May 2004 05:48:28 -0000 1.13 +++ gameobjs.h 16 May 2004 16:49:13 -0000 1.14 @@ -134,6 +134,7 @@ private: int power; + unsigned int frame; }; Index: gameobjs.cpp =================================================================== RCS file: /cvsroot/super-tux/supertux/src/gameobjs.cpp,v retrieving revision 1.20 retrieving revision 1.21 diff -u -d -r1.20 -r1.21 --- gameobjs.cpp 16 May 2004 05:48:28 -0000 1.20 +++ gameobjs.cpp 16 May 2004 16:49:13 -0000 1.21 @@ -235,12 +235,16 @@ base.width = 32; base.height = 32; + + frame = 0; } void Trampoline::draw() { - img_trampoline[0]->draw((int)base.x, (int)base.y); + img_trampoline[frame]->draw((int)base.x, (int)base.y); + + frame = 0; if (debug_mode) fillrect(base.x - scroll_x, base.y - scroll_y, base.width, base.height, 75, 75, 0, 150); @@ -251,7 +255,7 @@ { physic.apply(frame_ratio, base.x, base.y); - + // Falling if (issolid(base.x + base.width/2, base.y + base.height)) { base.y = int((base.y + base.height)/32) * 32 - base.height; @@ -289,12 +293,19 @@ // TODO: compress springs // TODO: launch tux, if necessary - base.y = pplayer_c->base.y + pplayer_c->base.height; - base.height = (32 - (int)pplayer_c->base.y % 32); - if (base.height < 16) - { - base.height = 32; + int squish_amount = (32 - (int)pplayer_c->base.y % 32); + + if (squish_amount < 24) + frame = 3; + else if (squish_amount < 28) + frame = 2; + else if (squish_amount < 30) + frame = 1; + else + frame = 0; + if (squish_amount < 24) + { pplayer_c->physic.set_velocity_y(8); } } |