From: Ingo Ruhnke Date: Sat, 4 Oct 2014 15:14:46 +0000 (+0200) Subject: Added Kirby badguy X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=874054f94993793ab1a05236f2cd7a9d7c9b8da9;p=supertux.git Added Kirby badguy --- diff --git a/data/images/creatures/kirby/kirby.sprite b/data/images/creatures/kirby/kirby.sprite new file mode 100644 index 000000000..97fba4d40 --- /dev/null +++ b/data/images/creatures/kirby/kirby.sprite @@ -0,0 +1,23 @@ +(supertux-sprite + + (action + (name "left") + (fps 20) + (hitbox 8 12 38 38) + (images "walk-0.png" + "walk-1.png" + "walk-2.png" + "walk-3.png" + "walk-4.png" + "walk-5.png" + "walk-6.png" + "walk-7.png" + ) + ) + (action + (name "right") + (fps 20) + (hitbox 8 12 38 38) + (mirror-action "left") + ) +) diff --git a/data/images/creatures/kirby/walk-0.png b/data/images/creatures/kirby/walk-0.png new file mode 100644 index 000000000..8cb321623 Binary files /dev/null and b/data/images/creatures/kirby/walk-0.png differ diff --git a/data/images/creatures/kirby/walk-1.png b/data/images/creatures/kirby/walk-1.png new file mode 100644 index 000000000..0aab28c43 Binary files /dev/null and b/data/images/creatures/kirby/walk-1.png differ diff --git a/data/images/creatures/kirby/walk-2.png b/data/images/creatures/kirby/walk-2.png new file mode 100644 index 000000000..c8cc38948 Binary files /dev/null and b/data/images/creatures/kirby/walk-2.png differ diff --git a/data/images/creatures/kirby/walk-3.png b/data/images/creatures/kirby/walk-3.png new file mode 100644 index 000000000..7a7a2ef5e Binary files /dev/null and b/data/images/creatures/kirby/walk-3.png differ diff --git a/data/images/creatures/kirby/walk-4.png b/data/images/creatures/kirby/walk-4.png new file mode 100644 index 000000000..88298e5e5 Binary files /dev/null and b/data/images/creatures/kirby/walk-4.png differ diff --git a/data/images/creatures/kirby/walk-5.png b/data/images/creatures/kirby/walk-5.png new file mode 100644 index 000000000..1b5a436c9 Binary files /dev/null and b/data/images/creatures/kirby/walk-5.png differ diff --git a/data/images/creatures/kirby/walk-6.png b/data/images/creatures/kirby/walk-6.png new file mode 100644 index 000000000..d9d17edea Binary files /dev/null and b/data/images/creatures/kirby/walk-6.png differ diff --git a/data/images/creatures/kirby/walk-7.png b/data/images/creatures/kirby/walk-7.png new file mode 100644 index 000000000..13044d009 Binary files /dev/null and b/data/images/creatures/kirby/walk-7.png differ diff --git a/data/levels/halloween/halloween1.stl b/data/levels/halloween/halloween1.stl index dd16b2f58..345563ff5 100644 --- a/data/levels/halloween/halloween1.stl +++ b/data/levels/halloween/halloween1.stl @@ -208,6 +208,26 @@ (layer -50) (sprite "images/decal/halloween/tree.png") ) + (kirby + (x 1256) + (y 396) + ) + (kirby + (x 1096) + (y 172) + ) + (kirby + (x 1960) + (y 524) + ) + (kirby + (x 2984) + (y 588) + ) + (kirby + (x 2920) + (y 588) + ) (spawnpoint (name "main") (x 768) diff --git a/src/badguy/kirby.cpp b/src/badguy/kirby.cpp new file mode 100644 index 000000000..46df9cf7f --- /dev/null +++ b/src/badguy/kirby.cpp @@ -0,0 +1,43 @@ +// SuperTux +// Copyright (C) 2014 Ingo Ruhnke +// +// 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 "badguy/kirby.hpp" + +#include "sprite/sprite.hpp" +#include "supertux/object_factory.hpp" + +Kirby::Kirby(const Reader& reader) + : WalkingBadguy(reader, "images/creatures/kirby/kirby.sprite", "left", "right") +{ + walk_speed = 80; +} + +Kirby::Kirby(const Vector& pos, Direction d, std::string script) + : WalkingBadguy(pos, d, "images/creatures/kirby/kirby.sprite", "left", "right") +{ + walk_speed = 80; + dead_script = script; +} + +bool +Kirby::collision_squished(GameObject& object) +{ + //sprite->set_action(dir == LEFT ? "squished-left" : "squished-right"); + kill_squished(object); + return true; +} + +/* EOF */ diff --git a/src/badguy/kirby.hpp b/src/badguy/kirby.hpp new file mode 100644 index 000000000..08085a0c0 --- /dev/null +++ b/src/badguy/kirby.hpp @@ -0,0 +1,35 @@ +// SuperTux +// Copyright (C) 2014 Ingo Ruhnke +// +// 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_KIRBY_HPP +#define HEADER_SUPERTUX_BADGUY_KIRBY_HPP + +#include "badguy/walking_badguy.hpp" + +class Kirby : public WalkingBadguy +{ +public: + Kirby(const Reader& reader); + Kirby(const Vector& pos, Direction d, std::string script); + +protected: + bool collision_squished(GameObject& object); + +}; + +#endif + +/* EOF */ diff --git a/src/supertux/object_factory.cpp b/src/supertux/object_factory.cpp index 3699f3c8f..225082242 100644 --- a/src/supertux/object_factory.cpp +++ b/src/supertux/object_factory.cpp @@ -44,6 +44,7 @@ #include "badguy/igel.hpp" #include "badguy/jumpy.hpp" #include "badguy/kamikazesnowball.hpp" +#include "badguy/kirby.hpp" #include "badguy/kugelblitz.hpp" #include "badguy/livefire.hpp" #include "badguy/mole.hpp" @@ -200,6 +201,7 @@ ObjectFactory::init_factories() add_factory("igel"); add_factory("jumpy"); add_factory("kamikazesnowball"); + add_factory("kirby"); add_factory("kugelblitz"); add_factory("livefire"); add_factory("livefire_asleep");