From 71ea91f6bf80d100535a0b79f004785d1d8db8b2 Mon Sep 17 00:00:00 2001 From: Florian Forster Date: Tue, 2 Mar 2010 11:34:03 +0000 Subject: [PATCH] Short Fuse: Implemented the new minibomb from the Milestone 2 Design Document. Short Fuse is a small version of Mr. Bomb, possibly his offspring. Like all children, it runs around faster than his big relatives do but can't do any harm. Short Fuse will explode immediately on contact but without hurting anybody. Instead, the explosion will throw Tux and other badguys about. A short test level is included as well. SVN-Revision: 6511 --- data/images/creatures/short_fuse/center.png | Bin 0 -> 1441 bytes data/images/creatures/short_fuse/left.png | Bin 0 -> 1273 bytes data/images/creatures/short_fuse/right.png | Bin 0 -> 1675 bytes data/images/creatures/short_fuse/short_fuse.sprite | 16 +++ data/levels/test/short_fuse.stl | 111 +++++++++++++++++++++ src/badguy/short_fuse.cpp | 101 +++++++++++++++++++ src/badguy/short_fuse.hpp | 37 +++++++ src/supertux/object_factory.cpp | 2 + 8 files changed, 267 insertions(+) create mode 100644 data/images/creatures/short_fuse/center.png create mode 100644 data/images/creatures/short_fuse/left.png create mode 100644 data/images/creatures/short_fuse/right.png create mode 100644 data/images/creatures/short_fuse/short_fuse.sprite create mode 100644 data/levels/test/short_fuse.stl create mode 100644 src/badguy/short_fuse.cpp create mode 100644 src/badguy/short_fuse.hpp diff --git a/data/images/creatures/short_fuse/center.png b/data/images/creatures/short_fuse/center.png new file mode 100644 index 0000000000000000000000000000000000000000..7c030ecf0aa15998c9cad7fb4ef0a426bfe860bc GIT binary patch literal 1441 zcmV;S1z!4zP)Px#32;bRa{vGf6951U69E94oEQKA00(qQO+^RV0|6Bt0XfFzjsO4v9dt!lbVF}# zZDnqB07G(RVRU6=Aa`kWXdqN*WgtgMO;GP-C2jx!1qw+-K~zY`rIlN3R8lpx&)z!u{HOVq3r-RWT0}VY}>uts1FuO}j$woJ2u-^F27eGojz9+!D04hUh z{Z8S;ey014G}e5sh6wX*JK17PmI1PW6o@Sr<5gBLs;j)byn>8?CnC!~?iWu)bn#pn zjO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Io!IotfI2Kv?R2q zx3|~)ubL}-x>^2m%#km>Iw^oOJn|eox@`mf8!3idp0oAx*|dtH0)FNLDe$R%l< z4If}B#nIE#Z+D*3vC(0;VpZ8k609u0TJ}G-Q~Lk>vOF`dYR2Gk&d%IhN@3=b_=>_G zY1w@C;cd9urR(l5QXLBMb6*iWu%7|tz{3ZjzYA;dIKI>f*}g6S@uIliD4^X*DOH7% zrOOtPn949X7H4PP;BnVO+b!E68Ku;jpukSB^&joTeHOookI`TTx!tFDDxJotQr3=e z&>~o1Q64PdP~N2>mm}5J$*@0+&ZlYpWSGq@2Z+4#GM^6yA(n1JaSE4 z^|UGsO<(^x79?^U%BR)MMo{nT>2liZZ@@pVjPa3CQUbqAyRhSY0H)^he}FH$}VL$FDIG) z&JS0(fwDL27u^!L=jtU=<59{s99#v%wk^B&zN9+$K21~O-L7fX>fg7u&~y07?9kBA zHL+N1^zvr$;^~;t9-F;v_C*HH8od(847N#`Ly`c zajfwHg1`h2EhxTZ(4?#I;m+Ch$hlE`B~;K08Rh zzw--Zb9>IatTBT*ALIdhlsYQ%+c77>K}gHoVgK z6DX+y?FDxVM$bU>3_2afXU7Sc5cDdtcAi)~DVg3jHG8WI(0oGss5eax=QEsi?X_yL zCm=~X!^+wPcq0L@FKn%A=XtOD3~^i@vb^-l(pSkjoPGD?)~Yn@O^{`z>y- zh){Ls9axbF(M*;zufHzM9dD~1$E8YZZt{XpDTW+4WJ|jOsMA(Br5LZQ2vJ;GI9=VV zXM`s?hrWLf0I=Qb;km5M3BT_R{Gn^no?`Nu*!`(Q$zz>u%2>FNu5KzxU*{6L<}!&|n^sHmPUXQ~d6e*^4D VxBV<*Us3=7002ovPDHLkV1gnDGqV5y literal 0 HcmV?d00001 diff --git a/data/images/creatures/short_fuse/short_fuse.sprite b/data/images/creatures/short_fuse/short_fuse.sprite new file mode 100644 index 000000000..07a63a768 --- /dev/null +++ b/data/images/creatures/short_fuse/short_fuse.sprite @@ -0,0 +1,16 @@ +(supertux-sprite + (action + (name "left") + (fps 12.5) + (hitbox 9 2 15 18) + (images "left.png" + "center.png" + "right.png" + "center.png")) + + (action + (name "right") + (fps 12.5) + (hitbox 9 2 15 18) + (mirror-action "left")) +) diff --git a/data/levels/test/short_fuse.stl b/data/levels/test/short_fuse.stl new file mode 100644 index 000000000..6a86d649f --- /dev/null +++ b/data/levels/test/short_fuse.stl @@ -0,0 +1,111 @@ +(supertux-level + (version 2) + (name (_ "Short fuse bomb test")) + (author "octo") + (contact "supertux at octo.it") + (license "GPL 2+ / CC-by-sa 3.0") + (sector + (name "main") + (ambient-light 1 1 1) + (camera + (mode "normal") + ) + (short_fuse + (x 192) + (y 1024) + ) + (short_fuse + (x 704) + (y 1024) + ) + (short_fuse + (x 1152) + (y 1024) + ) + (short_fuse + (x 1344) + (y 1024) + ) + (short_fuse + (x 1536) + (y 1024) + ) + (short_fuse + (x 1760) + (y 1024) + ) + (short_fuse + (x 1856) + (y 1024) + ) + (short_fuse + (x 1952) + (y 1024) + ) + (short_fuse + (x 2272) + (y 1024) + ) + (short_fuse + (x 2560) + (y 1024) + ) + (short_fuse + (x 2912) + (y 1024) + ) + (short_fuse + (x 2304) + (y 832) + ) + (spawnpoint + (name "main") + (x 32) + (y 864) + ) + (tilemap + (solid #t) + (z-pos 0) + (name "Interactive") + (width 100) + (height 35) + (tiles + 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 + 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0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 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 51 52 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 51 52 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 51 52 + 50 49 50 49 50 49 50 49 50 49 50 49 50 49 50 49 50 49 50 49 50 49 50 49 50 49 50 49 50 49 50 49 50 49 50 49 50 49 50 49 50 49 50 49 50 49 50 49 50 49 0 0 50 49 50 49 50 49 50 49 50 49 50 49 50 49 50 49 50 49 50 49 50 49 50 49 50 49 50 49 50 49 50 49 50 49 50 49 50 49 50 49 50 49 50 49 50 49 50 49 + 51 52 51 52 51 52 51 52 51 52 51 52 51 52 51 52 51 52 51 52 51 52 51 52 51 52 51 52 51 52 51 52 51 52 51 52 51 52 51 52 51 52 51 52 51 52 51 52 51 52 0 0 51 52 51 52 51 52 51 52 51 52 51 52 51 52 51 52 51 52 51 52 51 52 51 52 51 52 51 52 51 52 51 52 51 52 51 52 51 52 51 52 51 52 51 52 51 52 51 52 + ) + ) + ) +) diff --git a/src/badguy/short_fuse.cpp b/src/badguy/short_fuse.cpp new file mode 100644 index 000000000..db16a61ab --- /dev/null +++ b/src/badguy/short_fuse.cpp @@ -0,0 +1,101 @@ +// SuperTux +// Copyright (C) 2006 Matthias Braun +// Copyright (C) 2010 Florian Forster +// +// 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 3 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, see . + +#include "audio/sound_manager.hpp" +#include "badguy/bomb.hpp" +#include "badguy/short_fuse.hpp" +#include "object/explosion.hpp" +#include "object/player.hpp" +#include "sprite/sprite.hpp" +#include "sprite/sprite_manager.hpp" +#include "supertux/object_factory.hpp" +#include "supertux/sector.hpp" +#include "util/reader.hpp" +#include "util/log.hpp" + +#define EXPLOSION_FORCE 1000.0f + +ShortFuse::ShortFuse(const Reader& reader) : + WalkingBadguy(reader, "images/creatures/short_fuse/short_fuse.sprite", "left", "right") +{ + walk_speed = 100; + max_drop_height = -1; + + //Prevent stutter when Tux jumps on Mr Bomb + sound_manager->preload("sounds/explosion.wav"); + + //Check if we need another sprite + if( !reader.get( "sprite", sprite_name ) ){ + return; + } + if( sprite_name == "" ){ + sprite_name = "images/creatures/short_fuse/short_fuse.sprite"; + return; + } + //Replace sprite + sprite = sprite_manager->create( sprite_name ); +} + +/* ShortFuse created by a dispenser always gets default sprite atm.*/ +ShortFuse::ShortFuse(const Vector& pos, Direction d) : + WalkingBadguy(pos, d, "images/creatures/short_fuse/short_fuse.sprite", "left", "right") +{ + walk_speed = 80; + max_drop_height = 16; + sound_manager->preload("sounds/explosion.wav"); +} + +void +ShortFuse::explode (void) +{ + if (!is_valid ()) + return; + + Explosion *explosion = new Explosion (get_bbox ().get_middle ()); + + explosion->hurts (false); + explosion->pushes (true); + Sector::current()->add_object (explosion); + + remove_me (); +} + +bool +ShortFuse::collision_squished(GameObject& obj) +{ + if (!is_valid ()) + return true; + + Player* player = dynamic_cast(&obj); + if(player) + player->bounce(*this); + + explode (); + + return true; +} + +HitResponse +ShortFuse::collision_player (Player& player, const CollisionHit&) +{ + player.bounce (*this); + explode (); + return ABORT_MOVE; +} + +/* vim: set sw=2 sts=2 et : */ +/* EOF */ diff --git a/src/badguy/short_fuse.hpp b/src/badguy/short_fuse.hpp new file mode 100644 index 000000000..e6d497b15 --- /dev/null +++ b/src/badguy/short_fuse.hpp @@ -0,0 +1,37 @@ +// SuperTux +// Copyright (C) 2006 Matthias Braun +// Copyright (C) 2010 Florian Forster +// +// 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 3 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, see . + +#ifndef HEADER_SUPERTUX_BADGUY_SHORT_FUSE_HPP +#define HEADER_SUPERTUX_BADGUY_SHORT_FUSE_HPP + +#include "badguy/walking_badguy.hpp" + +class ShortFuse : public WalkingBadguy +{ +public: + ShortFuse(const Reader& reader); + ShortFuse(const Vector& pos, Direction d); + +protected: + HitResponse collision_player (Player& player, const CollisionHit& hit); + bool collision_squished (GameObject& object); + void explode (void); +}; + +#endif /* HEADER_SUPERTUX_BADGUY_SHORT_FUSE_HPP */ + +/* EOF */ diff --git a/src/supertux/object_factory.cpp b/src/supertux/object_factory.cpp index 5ee076e93..99c37e1cc 100644 --- a/src/supertux/object_factory.cpp +++ b/src/supertux/object_factory.cpp @@ -49,6 +49,7 @@ #include "badguy/plant.hpp" #include "badguy/poisonivy.hpp" #include "badguy/root.hpp" +#include "badguy/short_fuse.hpp" #include "badguy/skullyhop.hpp" #include "badguy/smartball.hpp" #include "badguy/snail.hpp" @@ -195,6 +196,7 @@ ObjectFactory::init_factories() add_factory("mrtree"); add_factory("plant"); add_factory("poisonivy"); + add_factory("short_fuse"); add_factory("sspiky"); add_factory("skullyhop"); add_factory("smartball"); -- 2.11.0