From d9f6263a08f49c6f4338185a6e42110099a3172c Mon Sep 17 00:00:00 2001 From: Marek Moeckel Date: Wed, 20 Jul 2005 14:49:01 +0000 Subject: [PATCH] added Mr Fluffy badguy I want him for a secret (he's going to appear only once in the whole game), so please don't mention him anywhere or put him in the editor! SVN-Revision: 2739 --- data/images/creatures/mr_fluffy/left-0.png | Bin 0 -> 2858 bytes data/images/creatures/mr_fluffy/left-1.png | Bin 0 -> 2857 bytes data/images/creatures/mr_fluffy/left-2.png | Bin 0 -> 3024 bytes data/images/creatures/mr_fluffy/squished-left.png | Bin 0 -> 1532 bytes data/images/sprites.strf | 27 ++++++ src/badguy/fluffy.cpp | 99 ++++++++++++++++++++++ src/badguy/fluffy.hpp | 44 ++++++++++ 7 files changed, 170 insertions(+) create mode 100644 data/images/creatures/mr_fluffy/left-0.png create mode 100644 data/images/creatures/mr_fluffy/left-1.png create mode 100644 data/images/creatures/mr_fluffy/left-2.png create mode 100644 data/images/creatures/mr_fluffy/squished-left.png create mode 100644 src/badguy/fluffy.cpp create mode 100644 src/badguy/fluffy.hpp diff --git a/data/images/creatures/mr_fluffy/left-0.png b/data/images/creatures/mr_fluffy/left-0.png new file mode 100644 index 0000000000000000000000000000000000000000..ba96d87206336f3fe5d033e0c70839b2ddb1e82e GIT binary patch literal 2858 zcmV+_3)S?AP)WFU8GbZ8({Xk{QrNlj4iWF>9@01A#tL_t(o!_Am`jNI2% z$3OS?oY~o#eXqT{b{yOBCR#gfic;t!YSLmND6~atC`AE^go=bfL?Wsn2q6S2Nre?; z1&~k?g@`~<6N+8(XiY>Dx1xD8sU3Tr#97yNcC+5+%>3r}zAye5?=~CT8;6&;f6e^P z`Tf2hoqNwY_g?saI>dkH<-fY~pX`NfiKxt}`5~j>5UI`(z!$#ytK$C@?6JF#*q6_r zB@jL%y$u?DeFVNswHD%sK9$hN_g#`s#+e^1kmMyeJWw4Ix8GSF9L za&nxlHw@$T`luYNwTO#fGRh*XAx|}>G#CZV3oTxH@iktLX1VWccZ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i9LJf@Z%hnqzuNI%{b~#H^}=#7WOPK9+s>Q3eKzySXXOg^_XltWImLPyr$HSu1t9R z*yrYe_3HtPo_OxjUtYZb=fC)2voGxgGi;xp=FWXLvpy`zi;6WhqM>vCeC40;LSpia zAV~?NpfTMc%S)O;KvCr0OS$qN&mSECE5JS1`>68CnRfH99-Q3{!0Y?(9Z&V=r<$=4 zge|_^dm+gn_qr#+jiL4MUQ>!srF#lCrO)ZUpjb3zrK9qL-+nDdv{K;zP!S#h32)31$Hzd z&^7IBK(LWOz4u`!iV9#4@azx$r~(|?VTk~`JGaq)bDd93rJAX9XuTItzWD5pADfw} zix*#tUpQ9K-Zm{juoobKO4ryVA_yB^hSHbgQeGUW3g`m&T@TpI&)svUKe+!Ubftt4 z0vX6CA7pbcf8)EVr*(1HPu$VoyK6f;7jF<%R>H;&N+5_D@#G1?I3Ys`LipY@-xA+B za`a8$k?R3F{Orowfuh^m*&k+6Ue;4#Anmy~*VKvS<+5(aT~5c5zj@cZ6KR|e zYo)yRNfZWITgpbE&ARH1-#fp(Yf5Lu8^iG!I1TK+*1-P*u7?4Wxjrfk00000NkvXX Hu0mjfyPIv} literal 0 HcmV?d00001 diff --git a/data/images/creatures/mr_fluffy/left-2.png b/data/images/creatures/mr_fluffy/left-2.png new file mode 100644 index 0000000000000000000000000000000000000000..19bbad6f22f127f9d373a8d09c615f4c09da0299 GIT binary patch literal 3024 zcmV;>3orDEP)WFU8GbZ8({Xk{QrNlj4iWF>9@01GrpL_t(o!_Am$jGWh5 z$A9O&&O5U+yF0sUuP?FVP2xD~b)2|P(zGEL2>lSrt`cZzmBN=wl@Oq+MF?^82aAdz zB2`ttP!S=hsMM-KD2||RQ(H-C)2MD-W4v~5^>w}8``q69x$$9a$J^KrQ2}wjj5N=@ z=lRWZ`9J49@c(p)U*_SjJ^d{^mo3sQb83Fbns9_vX9(brzWrJ8e+u@mfB2I9&+}&q zgwNPOgT~+>f$tL4Lj2ID68iYQOVZ0YeP*5{FUiW3&wuk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1aA+CW{EI2>ik=k36>Txdund z@~3*YP#^g8^>tI<)r7L(`z|2JO^y%}Ap}XRh*lMju$1b2ff1_4 zS0a5Mtqm&GRHIt}E7b(0G_I65E+mN|N-~tP6axnf2r2Pgi37~sTw-EniqvEXt*KQj z#Gs)|2$d=CT@9){Lk%H?WjbW)0QEIBEvAGH9+?uu4;&~DY zSRqiUVY!?zw@@WXGAh+7i|Hb{P6_fHDIB7xj5a2Yw0`UdZ@%!e56zk{-+e*~=x>wq zphX_93km^2fl{fFuI5%M)f!4Ea;v~(s4T%c4j6;*0*uzAwHkSr;7W(wC}WISu-cAG ic;wkPp1<}%S@U15HjC3vR@e*x0000 +// +// 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 "fluffy.hpp" + +static const float WALKSPEED = 80; + +Fluffy::Fluffy(const lisp::Lisp& reader) +{ + reader.get("x", start_position.x); + reader.get("y", start_position.y); + bbox.set_size(31.8, 31.8); + sprite = sprite_manager->create("fluffy"); + set_direction = false; +} + +Fluffy::Fluffy(float pos_x, float pos_y, Direction d) +{ + start_position.x = pos_x; + start_position.y = pos_y; + bbox.set_size(31.8, 31.8); + sprite = sprite_manager->create("fluffy"); + set_direction = true; + initial_direction = d; +} + +void +Fluffy::write(lisp::Writer& writer) +{ + writer.start_list("fluffy"); + + writer.write_float("x", start_position.x); + writer.write_float("y", start_position.y); + + writer.end_list("fluffy"); +} + +void +Fluffy::activate() +{ + if (set_direction) {dir = initial_direction;} + physic.set_velocity_x(dir == LEFT ? -WALKSPEED : WALKSPEED); + sprite->set_action(dir == LEFT ? "left" : "right"); +} + +bool +Fluffy::collision_squished(Player& player) +{ + sprite->set_action(dir == LEFT ? "squished-left" : "squished-right"); + kill_squished(player); + return true; +} + +HitResponse +Fluffy::collision_solid(GameObject& , const CollisionHit& hit) +{ + if(fabsf(hit.normal.y) > .5) { // hit floor or roof? + physic.set_velocity_y(0); + } else { // hit right or left + dir = dir == LEFT ? RIGHT : LEFT; + sprite->set_action(dir == LEFT ? "left" : "right"); + physic.set_velocity_x(-physic.get_velocity_x()); + } + + return CONTINUE; +} + +HitResponse +Fluffy::collision_badguy(BadGuy& , const CollisionHit& hit) +{ + if(fabsf(hit.normal.x) > .8) { // left or right hit + dir = dir == LEFT ? RIGHT : LEFT; + sprite->set_action(dir == LEFT ? "left" : "right"); + physic.set_velocity_x(-physic.get_velocity_x()); + } + + return CONTINUE; +} + +IMPLEMENT_FACTORY(Fluffy, "fluffy") diff --git a/src/badguy/fluffy.hpp b/src/badguy/fluffy.hpp new file mode 100644 index 000000000..f26f0a1a2 --- /dev/null +++ b/src/badguy/fluffy.hpp @@ -0,0 +1,44 @@ +// $Id: snowball.hpp 2642 2005-06-26 13:38:53Z matzebraun $ +// +// SuperTux +// Copyright (C) 2005 Matthias Braun +// +// 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 __FLUFFY_H__ +#define __FLUFFY_H__ + +#include "badguy.hpp" + +class Fluffy : public BadGuy +{ +public: + Fluffy(const lisp::Lisp& reader); + Fluffy(float pos_x, float pos_y, Direction d); + + void activate(); + void write(lisp::Writer& writer); + HitResponse collision_solid(GameObject& other, const CollisionHit& hit); + HitResponse collision_badguy(BadGuy& other, const CollisionHit& hit); + +protected: + bool collision_squished(Player& player); + bool set_direction; + Direction initial_direction; +}; + +#endif + -- 2.11.0