Added Kirby badguy
authorIngo Ruhnke <grumbel@gmail.com>
Sat, 4 Oct 2014 15:14:46 +0000 (17:14 +0200)
committerIngo Ruhnke <grumbel@gmail.com>
Sat, 4 Oct 2014 15:14:46 +0000 (17:14 +0200)
13 files changed:
data/images/creatures/kirby/kirby.sprite [new file with mode: 0644]
data/images/creatures/kirby/walk-0.png [new file with mode: 0644]
data/images/creatures/kirby/walk-1.png [new file with mode: 0644]
data/images/creatures/kirby/walk-2.png [new file with mode: 0644]
data/images/creatures/kirby/walk-3.png [new file with mode: 0644]
data/images/creatures/kirby/walk-4.png [new file with mode: 0644]
data/images/creatures/kirby/walk-5.png [new file with mode: 0644]
data/images/creatures/kirby/walk-6.png [new file with mode: 0644]
data/images/creatures/kirby/walk-7.png [new file with mode: 0644]
data/levels/halloween/halloween1.stl
src/badguy/kirby.cpp [new file with mode: 0644]
src/badguy/kirby.hpp [new file with mode: 0644]
src/supertux/object_factory.cpp

diff --git a/data/images/creatures/kirby/kirby.sprite b/data/images/creatures/kirby/kirby.sprite
new file mode 100644 (file)
index 0000000..97fba4d
--- /dev/null
@@ -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 (file)
index 0000000..8cb3216
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 (file)
index 0000000..0aab28c
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 (file)
index 0000000..c8cc389
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 (file)
index 0000000..7a7a2ef
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 (file)
index 0000000..88298e5
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 (file)
index 0000000..1b5a436
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 (file)
index 0000000..d9d17ed
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 (file)
index 0000000..13044d0
Binary files /dev/null and b/data/images/creatures/kirby/walk-7.png differ
index dd16b2f..345563f 100644 (file)
       (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 (file)
index 0000000..46df9cf
--- /dev/null
@@ -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 */
diff --git a/src/badguy/kirby.hpp b/src/badguy/kirby.hpp
new file mode 100644 (file)
index 0000000..08085a0
--- /dev/null
@@ -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 */
index 3699f3c..2250822 100644 (file)
@@ -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>("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");