From 6c048de80b00a88e9c43290b1e5ccd1dd35e74a4 Mon Sep 17 00:00:00 2001 From: Wolfgang Becker Date: Sun, 10 Feb 2008 21:56:41 +0000 Subject: [PATCH] smartball: a snowball, smart enough to stay on his platform. SVN-Revision: 5321 --- .../creatures/snowball/smart-snowball.sprite | 24 +++++++++++ data/images/creatures/snowball/snowball.sprite | 7 ++-- data/images/creatures/snowball/sport-left-0.png | Bin 0 -> 2930 bytes data/images/creatures/snowball/sport-left-1.png | Bin 0 -> 2939 bytes data/images/creatures/snowball/sport-left-2.png | Bin 0 -> 3107 bytes src/badguy/smartball.cpp | 46 +++++++++++++++++++++ src/badguy/smartball.hpp | 41 ++++++++++++++++++ src/control/joystickkeyboardcontroller.cpp | 2 - 8 files changed, 114 insertions(+), 6 deletions(-) create mode 100644 data/images/creatures/snowball/smart-snowball.sprite create mode 100644 data/images/creatures/snowball/sport-left-0.png create mode 100644 data/images/creatures/snowball/sport-left-1.png create mode 100644 data/images/creatures/snowball/sport-left-2.png create mode 100644 src/badguy/smartball.cpp create mode 100644 src/badguy/smartball.hpp diff --git a/data/images/creatures/snowball/smart-snowball.sprite b/data/images/creatures/snowball/smart-snowball.sprite new file mode 100644 index 000000000..d10de90c9 --- /dev/null +++ b/data/images/creatures/snowball/smart-snowball.sprite @@ -0,0 +1,24 @@ +(supertux-sprite + (action + (name "left") + (hitbox 2 4 31.8 31.8) + (images "left-0.png" + "left-1.png" + "left-2.png") + ) + (action + (name "right") + (hitbox 2 4 31.8 31.8) + (mirror-action "left") + ) + (action + (name "squished-left") + (hitbox 1 -19 31.8 31.8) + (images "squished-left.png") + ) + (action + (name "squished-right") + (hitbox 1 -19 31.8 31.8) + (mirror-action "squished-left") + ) +) diff --git a/data/images/creatures/snowball/snowball.sprite b/data/images/creatures/snowball/snowball.sprite index d10de90c9..ed9f5dfa7 100644 --- a/data/images/creatures/snowball/snowball.sprite +++ b/data/images/creatures/snowball/snowball.sprite @@ -1,10 +1,9 @@ (supertux-sprite (action (name "left") - (hitbox 2 4 31.8 31.8) - (images "left-0.png" - "left-1.png" - "left-2.png") + (images "sport-left-0.png" + "sport-left-1.png" + "sport-left-2.png") ) (action (name "right") diff --git a/data/images/creatures/snowball/sport-left-0.png b/data/images/creatures/snowball/sport-left-0.png new file mode 100644 index 0000000000000000000000000000000000000000..82454b90ed3d8f4cf3b60e31513237ffaf2c7606 GIT binary patch literal 2930 zcmV-&3yt)NP)5000X)Nkl45Ab;p1AE%RpO3^`mxQq)3;S}4k{B_(ncCkOy1af38=Y)FVM_5)2?bR=8N z`SRYJd*=Lq@7y!*+!6ea_W8%Yr>czxuIFQ!CT*ECp6?@+;zzr_Bz~8i|F17S{QY03 z@hejpx=vdrO$usAeE|z$9_gCIi?^cUx zVC|oLVOc(iP^a z)5Vsp+mNP(6Drb{!Hg4;Fm*(#(q2YNhi9~{AB0(mVqEsqTDiskz&}cNtWYPdAsp#(RMmKcQ=`_hi zlFrUNVHh$qTO^fCkjbRU=Q|i29K^P5O63YCN6*s~7HdEFQFc81ZS{+9{-wAPX7&Fb zI=o}{?|0Ld&0@wZG$Dw>09_Mw_j(fXv4Li{gft=IF8Moy*Wx(Cjq!VcAhKa7dU+AAfNr?huE@t6GN+4 zV;BbYMuTFhL_D4#ol3In>yIF;OisOi_%{n8Hwx_^EdX%e+TKMV?~dEO?-Z$Il9p|A zM{kz2WddO78kP=1)A;E#&+w}kUtsIVI{x%?pQW?23qK4=SQf79@}0+@K^-KEAFGr4%=_d7ytiI7S%wtnbcX89D+mb%7s*7`n!_nuFh}Q@nPC zy+8di16?_Ge)5y7T(z1rXV38bi@!ve@r3dn8>JLM5D<&S7GPdFHwD1<^-FIFGavhd zW0#2OkWX3w7@EM)1f_;e5J{?Dgo#8bNwrqz)zhPl?)z^>)($by(}kJMqZ#6zghN9^ zi>mW(8y+6M<$7n*q&;pTrNr?9qDazk1Bwlsy5r$`0d?DGu|$$gCPO?PUl1|l34{=6+B@^->eZ`@s&Qij z1NcEit>q9&Nf1VF&$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#q9zzV7+o0-kywt@niiuz@#$pNw6e z-ZL>ZebVuQAz>Q1_I%b@x@I7Gd2(7iI5E}s%J@_&l(IC^)5*`yUihD9&y6j2!{{G? zZ{3E@ZNc1VmBLKr)T?idzWmzhv3%3@I^8g`8iop5;GDfUwLg?fJ9_o{OvUkD0iFlG cce}~|4~uc$ICvyO*8l(j07*qoM6N<$f^kWq+W-In literal 0 HcmV?d00001 diff --git a/data/images/creatures/snowball/sport-left-1.png b/data/images/creatures/snowball/sport-left-1.png new file mode 100644 index 0000000000000000000000000000000000000000..1abb5db5b0179fe47abceea35e243d21befd266b GIT binary patch literal 2939 zcmV->3xxEEP)5000X@NklYOvr|Mx!Une#kn1izzw;py+HdaH#WgxID@A)g}%LxfU%|A{Y&-^J$#`qJaiy`aW! zOk(Idg?x@ev4o);q%$dO%fd2EEM3ECyG-1i!S@4#(Bpf5`-R_1=eJt)^&cKlGxJr7 z`3&n<4>PiAfQ)V7#tNkr0uTb?L?Tc${g@z;BuX(~t#bb2Wo9c?esb_D@2mG-lR04h zpM2vxXF5wIdV2cUI;p;_Oa>LkJ7beD+3({Ovg+(4%J+id_K>$ zvA3D8)+n!9OFCPi*xduBO%lfxGbysRNyCp3Dj{zR?!R{ntA+*v<$e zf|QatiinehY$l7YYuL7puIukO5{s@}*Tr=`&YnHXp_gBwYj72NKJh8YcQWUMfa2v- zZ(t@N|N2)4#9d*wZ{L35(4j+{bNRf8;~3L0Fbsnr2$`Lo0U%!}kV&UWk_4ySMkz%$ zlSR`6rfHH&rBF&Cr6frbeBY=@sF?DNYEOF8rB zgM))(m*2X&1)&iHKIwFtOgc?Io26Q z-48s##tj=tr_)4H#Qb~(P1oosccNPsAMNj>zubXWuPprc5B_uC?Fpoo9u6M4z$Z5J z<3|Z$A^|utUg2vW-?}3E4<5O|w!sc&s|#Gaag*BgBw4?XQ?GI5{5e9W&h{NU`O25S zL~lMJqc2=F|YZT%&xQxgEpTpQ)a*i}xRIL_z(__OTVxr32)>o5$1 zW~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+SwO=@hb4`4;q>0kIz*$yB*oJ3k@gJ_JUzU z*SyK;O7qRBshTV0n#X>0`-Vbaw=v lOvLp@YZkZ+bly$y{{ZhW)&7O`{Cxlb002ovPDHLkV1kyhst^DG literal 0 HcmV?d00001 diff --git a/data/images/creatures/snowball/sport-left-2.png b/data/images/creatures/snowball/sport-left-2.png new file mode 100644 index 0000000000000000000000000000000000000000..e853efeb908d821015307b775b15ba8095abd051 GIT binary patch literal 3107 zcmV+;4BYdHP)Nkl+83_*;mQhrO`;jlCZpBBaEXE7gh>ai61ygQQ#sKLLf<{LRDN&VwuEL z;#8ajs!}EkPyynERANJU!!iyivNmHOd9>M{#Tw22=FQuB?|buOMq`aE8z|17?sxCG z=X`zc>2vOD!7m~AKl-m~p_26g4FJt=`Ui`qipUdZaDP@68zxAcB zoNOr;>FDTU+lDo?W=z@&1*B4VVMNsnal;r;=$eMmbR5&b)CCncz>5-;W)KOTi|5aB z{MFNZ|1baGXTllR8|>-nd1U|o{Wl*!KfHJH*bB4`ZlkAUz+}u=qd_^FA(zYX=I{u! z<#}3Ht;NaYDYSQhX_Le;g>;IHZBq4Pgi6TSf}6GvvZ}8aq3P;-UwZGzy<_t6#~=Ud z&Ye3ybHm!ThCpEG8bKHm$1zUILDzMZk_aJKs8*RTmjUoRj}s?PQYaP~pPE7D+S$G5 zR-|d;#fq$LFykdSrp|@&DUKXD!qX3b?p@)oo!I%zGtV6B>+3gqdV5IOHm>K9BneVV z;wU0c5;Exwx~^f{HoC6AZA>hhb6pqL^?2o#S9tpQAJEpjiaS5@QOLD0(+B~@^T$tN zCLv$@-2>N!TQPX!jW?co`st^)W^*|a$1$d1U>F8L5HdYI1wbyJC+#>SNkXI9L@7lk zok7zCrfHH&rBF&Cr6frbeBYvAG(BE$^q;(G9>0hYsh2Dw}o03{V29UbU~PBxn*?WAdI zYbB0jW@hKeq#bg(EUm3AtX;bn*L5k+S2%s)JPl#9>83l_|G?j=r~cv#;@!a3zjWm2 z{@Fh}NWM_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al 0 HcmV?d00001 diff --git a/src/badguy/smartball.cpp b/src/badguy/smartball.cpp new file mode 100644 index 000000000..aaf433bb4 --- /dev/null +++ b/src/badguy/smartball.cpp @@ -0,0 +1,46 @@ +// $Id$ +// +// SuperTux - Smart Snowball +// Copyright (C) 2008 Wolfgang Becker +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License +// as published by the Free Software Foundation; either version 2 +// of the License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +#include + +#include "smartball.hpp" + +SmartBall::SmartBall(const lisp::Lisp& reader) + : WalkingBadguy(reader, "images/creatures/snowball/smart-snowball.sprite", "left", "right") +{ + walk_speed = 80; + max_drop_height = 16; +} + +SmartBall::SmartBall(const Vector& pos, Direction d) + : WalkingBadguy(pos, d, "images/creatures/snowball/smart-snowball.sprite", "left", "right") +{ + walk_speed = 80; + max_drop_height = 16; +} + +bool +SmartBall::collision_squished(GameObject& object) +{ + sprite->set_action(dir == LEFT ? "squished-left" : "squished-right"); + kill_squished(object); + return true; +} + +IMPLEMENT_FACTORY(SmartBall, "smartball") diff --git a/src/badguy/smartball.hpp b/src/badguy/smartball.hpp new file mode 100644 index 000000000..3631f39bf --- /dev/null +++ b/src/badguy/smartball.hpp @@ -0,0 +1,41 @@ +// $Id$ +// +// SuperTux - Smart Snowball +// Copyright (C) 2008 Wolfgang Becker +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License +// as published by the Free Software Foundation; either version 2 +// of the License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +#ifndef __SMARTBALL_H__ +#define __SMARTBALL_H__ + +#include "walking_badguy.hpp" + +/* + * Easy to kill badguy that does not jump down from it's ledge. + */ +class SmartBall : public WalkingBadguy +{ +public: + SmartBall(const lisp::Lisp& reader); + SmartBall(const Vector& pos, Direction d); + + virtual SmartBall* clone() const { return new SmartBall(*this); } + +protected: + bool collision_squished(GameObject& object); + +}; + +#endif diff --git a/src/control/joystickkeyboardcontroller.cpp b/src/control/joystickkeyboardcontroller.cpp index 4bf168eac..f9e140865 100644 --- a/src/control/joystickkeyboardcontroller.cpp +++ b/src/control/joystickkeyboardcontroller.cpp @@ -198,8 +198,6 @@ JoystickKeyboardController::read(const lisp::Lisp& lisp) continue; } keymap[(SDLKey) key] = (Control)i; - } else { - log_info << "Invalid lisp element '" << iter.item() << "' in keymap" << std::endl; } } } -- 2.11.0