From 14e4df62c7a65ee97ee922c460b066225dd3db72 Mon Sep 17 00:00:00 2001 From: Ryan Flegel Date: Tue, 25 May 2004 21:21:22 +0000 Subject: [PATCH] - added walking tree enemy. still needs some work SVN-Revision: 1328 --- data/images/shared/walkingtree-left-1.png | Bin 0 -> 4661 bytes data/images/shared/walkingtree-left-small-1.png | Bin 0 -> 2018 bytes data/supertux.strf | 9 ++++ src/badguy.cpp | 55 ++++++++++++++++++++++++ src/badguy.h | 7 ++- 5 files changed, 70 insertions(+), 1 deletion(-) create mode 100644 data/images/shared/walkingtree-left-1.png create mode 100644 data/images/shared/walkingtree-left-small-1.png diff --git a/data/images/shared/walkingtree-left-1.png b/data/images/shared/walkingtree-left-1.png new file mode 100644 index 0000000000000000000000000000000000000000..606ecc278d30211710e98181dd0874d966871766 GIT binary patch literal 4661 zcmV-563Xp~P)@e{1i3&b_x^!_Ykg!#r@NhnF}g(~|&#fG}4@NHkV7^dM@Y1}m0{MKr`7As{}X$M}SVp%HL+I1D{K)6;$LIeYJw59i$O zX5Q07-w&y*s#A04_Bm&-{oiY^z1DxN3;!%bW6db&8-2i8tC+0v-H4-b#{INz5w>P~>Q6jt`*;SnF64JD5l zh*A*&ba=$;q3##q2bo6~_hDKY*M`V#z&-QOl}6ne5iSwo)2bw@yd2mvpLgvoN3=EG z@=~|NSw3M5{{jp*>Tda=o>AqtEaxEsdb(Hyysc4p^Id@772&4TaRM+7>^{=>97qlu zh(_H>jJ(rX-Z^j#zujHqO5g*Hx=Ro7=y;6WGBJsE*GP=vV&Ie`QL<5YB5WCbGBju;M$W2M80hIjS}mRzBF&*e^TW}xxZizWK6jrF zoMVJl&eEOb_@O~FGCCFyxwT45c#Sn|s-`T-Jv)8i`t1|?wfi5_dHb5Z<*(`jOn;GX>VQF74u9b0qj4Up}Xdd9X$)PpoZtr?I&(NT8 zTgGDE{%&Z{JkJ`wSgW$6l`)=s{%m|wZ~p2J!^}O6x;u4f(7bB>8gs&iLG$3@0DM$H zl#_a5{Tl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za2C>p5F-(A+ZW1-kSM$i!1Aw``dQ{_J3 z+Z0sXeZY?4k^R>?k5oF*Ro9kn3X|>sgsAGhMiJE7BEXUW#ysPc@J4t~RPLnk@=qP9 z$sewC5{RZM+d}|nQH`qBf-#6M3OZ`7;=QzqT%kBvb`FpDhZb77PBfgh#RI?0JcuC1 zh&U_K4!PS-Q<=R`EJcL7;L_;jvJLi_mm(2Z)d~GNY7xM_Wi_iX0THYfV~j{tK~)G^ z{0Tt8iqO>w{W|F^QAK?~wWy2(MOq%qm?HN@JW*7-#L&To>ZG#-cqA&mUH)scQe}=p znP7=Xk?57zy!ntLkxm2ggepEpR8=shm~{vcLRlj%YN9g@0jjJ6x))lpP6N?Yr8POF zF@&OXhN5?3_Q)(xjPk2!4fk>M1nwcF(?IM5wq-e3TV$-lY^O{qB_<+3=&te8g^DKU zN~eLC6yc7a*a0Od*Iixbln79y0CghC5C zb9{Cbh(_IsD#y0BLX6OAY4oAA2xgi@+6I#Pz}ime*6FPwTC^{s3f^nDLL`=1UwT5C-$V{|lRY^ji`hPKwFhIXGMTl(-IIB3T zq^XK6y6ki=T@)e%Jj+%411Z)?sR*1x9#GKo?Z#4Lh(=IUP%TP+#;{?b73(w*>(c}`xACz38!Rar z)7413f1Oaa21JGDF0^7D1ENuPPK2{+bKIV_#wLl_N+Q~pqir9l%UGQLM!*bCkKu-(tfGC00000NkvXXu0mjf?7_n! literal 0 HcmV?d00001 diff --git a/data/images/shared/walkingtree-left-small-1.png b/data/images/shared/walkingtree-left-small-1.png new file mode 100644 index 0000000000000000000000000000000000000000..dc41ff53c100ea755f0935f29057d09b4f083c6b GIT binary patch literal 2018 zcmV<82Oao{P)<4QVWf
&(g>kN7>*_VWofo`T1h)P3QNQO{zK$E2X6gnLN6Q*^G*h=45P^@2uzhRl&N$p*Ux+-E zSe64{?5TYLWdz~*#IoL6ZZ`&Bcz!9upL%v(Gj;C@#A0c>*;+OY53tDy_W^Ygz9+(n zz>k5AF|tdQAi}0*>dsW<8^FI}>KefJs|nu%E)0Rr+(Bht;81U}bl`vXgc0cfVKD#Fi32KaKV zidaMJX^Sx;At19|rSK2}ga|Q0EWu)k1QA{vYOp5Dpp&s1*wSkI7w3FjeV!G!6qr`q zXWK4wdy@pQ7L5@EL?h(6YT;2IjsQs1@>dm9F{+rvF*eg76rP^|-)*)1p>xN?j;)aX zWdmkBaeQq_FwN8%Fh=}s9Eu$o{EF*KZtCyn;e6JizE|ShyBNq( zBXc}yrf$Sqo?JaDA2tRadqRt|57cqj8e{$!b9#cS&sAuoJzSiUIgAchM$e|Pl=-qJqug~B)~6@0@KL~ zp7KH0RT2@a=p0Pp%T*B~Qg{gEv_8n&Gikmr1KbMS+)P~#_=RaYiSkZ)3HU@ab?bo_ zfJxxhR@=|C+FqNfdn(JhzLG$jPtVB12N1b7x$mpFnET&0E`=$8Ri*5`$uKGWgrdBMMZfV|MS`J+ZY zb8fk@y9Mlj~NXxUj}Rlx`h z4-%|Fx*6o2;62ZW$d7;rfdj3!S2)4X+aBa-HDTAPw2xqn7*y~cjf%!7Dnb;P16Z*X zo9`zwXk?}+K(#zWjX}zjQ!%1ZL?eI*E0<#LzcpNNxpHvx&j0`b07*qoM6N<$f(65^ AdjJ3c literal 0 HcmV?d00001 diff --git a/data/supertux.strf b/data/supertux.strf index 75375daee..9bab02831 100644 --- a/data/supertux.strf +++ b/data/supertux.strf @@ -644,6 +644,15 @@ (y-hotspot 0) (images "shared/wingling-1.png")) + ; Walkingtree + (sprite (name "walkingtree-left") + (x-hotspot 0) + (y-hotspot 0) + (images "shared/walkingtree-left-1.png")) + (sprite (name "walkingtree-left-small") + (x-hotspot 0) + (y-hotspot 0) + (images "shared/walkingtree-left-small-1.png")) ) ;; EOF ;; diff --git a/src/badguy.cpp b/src/badguy.cpp index 0866f2269..b7879b56f 100644 --- a/src/badguy.cpp +++ b/src/badguy.cpp @@ -75,6 +75,8 @@ Sprite* img_snowball_right; Sprite* img_snowball_squished_left; Sprite* img_snowball_squished_right; Sprite* img_wingling_left; +Sprite* img_walkingtree_left; +Sprite* img_walkingtree_left_small; #define BADGUY_WALK_SPEED .8f #define WINGLING_FLY_SPEED 1.6f @@ -103,6 +105,8 @@ BadGuyKind badguykind_from_string(const std::string& str) return BAD_SNOWBALL; else if (str == "wingling") return BAD_WINGLING; + else if (str == "walkingtree") + return BAD_WALKINGTREE; else { printf("Couldn't convert badguy: '%s'\n", str.c_str()); @@ -147,6 +151,8 @@ std::string badguykind_to_string(BadGuyKind kind) case BAD_WINGLING: return "wingling"; break; + case BAD_WALKINGTREE: + return "walkingtree"; default: return "snowball"; } @@ -291,6 +297,13 @@ BadGuy::activate(Direction activation_dir) physic.set_velocity(dirsign * WINGLING_FLY_SPEED, 0); physic.enable_gravity(false); set_sprite(img_wingling_left, img_wingling_left); + } else if (kind == BAD_WALKINGTREE) { + // TODO: why isn't the height/width being set properly in set_sprite? + physic.set_velocity(dirsign * BADGUY_WALK_SPEED, 0); + mode = BGM_BIG; + set_sprite(img_walkingtree_left, img_walkingtree_left); + base.width = 66; + base.height = 66; } base.x = start_position.x; @@ -818,6 +831,23 @@ BadGuy::action_wingling(double elapsed_time) // TODO: Winglings should be removed after flying off the screen } +void +BadGuy::action_walkingtree(double elapsed_time) +{ + if (dying == DYING_NOT) + check_horizontal_bump(); + + fall(); + + physic.apply(elapsed_time, base.x, base.y); + if (dying != DYING_FALLING) + collision_swept_object_map(&old_base,&base); + + // Handle dying timer: + if (dying == DYING_SQUISHED && !timer.check()) + remove_me(); +} + void BadGuy::action(float elapsed_time) @@ -923,6 +953,10 @@ BadGuy::action(float elapsed_time) action_wingling(elapsed_time); break; + case BAD_WALKINGTREE: + action_walkingtree(elapsed_time); + break; + default: break; } @@ -1102,6 +1136,25 @@ BadGuy::squish(Player* player) } else if(kind == BAD_WINGLING) { squish_me(player); set_sprite(img_wingling_left, img_wingling_left); + } else if(kind == BAD_WALKINGTREE) { + if (mode == BGM_BIG) + { + set_sprite(img_walkingtree_left_small, img_walkingtree_left_small); + physic.set_velocity_x(physic.get_velocity_x() * 1.1); + // XXX magic number: 66 is BGM_BIG height + base.y += 66 - base.height; + + player->base.y = base.y - player->base.height - 2; + make_player_jump(player); + + World::current()->add_score(Vector(base.x, base.y), + 25 * player_status.score_multiplier); + player_status.score_multiplier++; + + mode = BGM_SMALL; + } + else + squish_me(player); } @@ -1353,6 +1406,8 @@ void load_badguy_gfx() img_snowball_squished_left = sprite_manager->load("snowball-squished-left"); img_snowball_squished_right = sprite_manager->load("snowball-squished-right"); img_wingling_left = sprite_manager->load("wingling-left"); + img_walkingtree_left = sprite_manager->load("walkingtree-left"); + img_walkingtree_left_small = sprite_manager->load("walkingtree-left-small"); } void free_badguy_gfx() diff --git a/src/badguy.h b/src/badguy.h index 0d8006a93..7b607e113 100644 --- a/src/badguy.h +++ b/src/badguy.h @@ -50,6 +50,7 @@ enum BadGuyKind { BAD_SPIKY, BAD_SNOWBALL, BAD_WINGLING, + BAD_WALKINGTREE, NUM_BadGuyKinds }; @@ -82,7 +83,10 @@ public: FISH_WAIT, FLY_UP, - FLY_DOWN + FLY_DOWN, + + BGM_BIG, + BGM_SMALL }; public: DyingType dying; @@ -147,6 +151,7 @@ private: void action_spiky(double frame_ratio); void action_snowball(double frame_ratio); void action_wingling(double frame_ratio); + void action_walkingtree(double frame_ratio); /** initializes the badguy (when he appears on screen) */ void activate(Direction direction); -- 2.11.0