Skip to content

Commit

Permalink
Added Kirby badguy
Browse files Browse the repository at this point in the history
  • Loading branch information
Grumbel committed Oct 4, 2014
1 parent e7b1a8b commit 874054f
Show file tree
Hide file tree
Showing 13 changed files with 123 additions and 0 deletions.
23 changes: 23 additions & 0 deletions 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")
)
)
Binary file added data/images/creatures/kirby/walk-0.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added data/images/creatures/kirby/walk-1.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added data/images/creatures/kirby/walk-2.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added data/images/creatures/kirby/walk-3.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added data/images/creatures/kirby/walk-4.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added data/images/creatures/kirby/walk-5.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added data/images/creatures/kirby/walk-6.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added data/images/creatures/kirby/walk-7.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
20 changes: 20 additions & 0 deletions data/levels/halloween/halloween1.stl
Expand Up @@ -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)
Expand Down
43 changes: 43 additions & 0 deletions src/badguy/kirby.cpp
@@ -0,0 +1,43 @@
// SuperTux
// Copyright (C) 2014 Ingo Ruhnke <grumbel@gmail.com>
//
// 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 <http://www.gnu.org/licenses/>.

#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 */
35 changes: 35 additions & 0 deletions src/badguy/kirby.hpp
@@ -0,0 +1,35 @@
// SuperTux
// Copyright (C) 2014 Ingo Ruhnke <grumbel@gmail.com>
//
// 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 <http://www.gnu.org/licenses/>.

#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 */
2 changes: 2 additions & 0 deletions src/supertux/object_factory.cpp
Expand Up @@ -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"
Expand Down Expand Up @@ -200,6 +201,7 @@ ObjectFactory::init_factories()
add_factory<Igel>("igel");
add_factory<Jumpy>("jumpy");
add_factory<KamikazeSnowball>("kamikazesnowball");
add_factory<Kirby>("kirby");
add_factory<Kugelblitz>("kugelblitz");
add_factory<LiveFire>("livefire");
add_factory<LiveFireAsleep>("livefire_asleep");
Expand Down

0 comments on commit 874054f

Please sign in to comment.