New BadGuys: 'iceflame' flame with fire vulnerability, 'ghostflame' flame without...
authorLMH <lmh.0013@gmail.com>
Tue, 9 Apr 2013 20:10:01 +0000 (10:10 -1000)
committerLMH <lmh.0013@gmail.com>
Tue, 9 Apr 2013 21:14:40 +0000 (11:14 -1000)
29 files changed:
data/images/creatures/flame/ghostflame-0.png [new file with mode: 0644]
data/images/creatures/flame/ghostflame-1.png [new file with mode: 0644]
data/images/creatures/flame/ghostflame-2.png [new file with mode: 0644]
data/images/creatures/flame/ghostflame-3.png [new file with mode: 0644]
data/images/creatures/flame/ghostflame-4.png [new file with mode: 0644]
data/images/creatures/flame/ghostflame-editor.png [new file with mode: 0644]
data/images/creatures/flame/ghostflame.sprite [new file with mode: 0644]
data/images/creatures/flame/ghostflame.xcf [new file with mode: 0644]
data/images/creatures/flame/iceflame-0.png [new file with mode: 0644]
data/images/creatures/flame/iceflame-1.png [new file with mode: 0644]
data/images/creatures/flame/iceflame-2.png [new file with mode: 0644]
data/images/creatures/flame/iceflame-3.png [new file with mode: 0644]
data/images/creatures/flame/iceflame-4.png [new file with mode: 0644]
data/images/creatures/flame/iceflame-5.png [new file with mode: 0644]
data/images/creatures/flame/iceflame-editor.png [new file with mode: 0644]
data/images/creatures/flame/iceflame-fade-0.png [new file with mode: 0644]
data/images/creatures/flame/iceflame-fade-1.png [new file with mode: 0644]
data/images/creatures/flame/iceflame-fade-2.png [new file with mode: 0644]
data/images/creatures/flame/iceflame-fade-3.png [new file with mode: 0644]
data/images/creatures/flame/iceflame.sprite [new file with mode: 0644]
data/images/creatures/flame/iceflame.xcf [new file with mode: 0644]
data/levels/test/glow_effects.stl
src/badguy/flame.cpp
src/badguy/ghostflame.cpp [new file with mode: 0644]
src/badguy/ghostflame.hpp [new file with mode: 0644]
src/badguy/iceflame.cpp [new file with mode: 0644]
src/badguy/iceflame.hpp [new file with mode: 0644]
src/object/bullet.cpp
src/supertux/object_factory.cpp

diff --git a/data/images/creatures/flame/ghostflame-0.png b/data/images/creatures/flame/ghostflame-0.png
new file mode 100644 (file)
index 0000000..18e0eae
Binary files /dev/null and b/data/images/creatures/flame/ghostflame-0.png differ
diff --git a/data/images/creatures/flame/ghostflame-1.png b/data/images/creatures/flame/ghostflame-1.png
new file mode 100644 (file)
index 0000000..b5ddef9
Binary files /dev/null and b/data/images/creatures/flame/ghostflame-1.png differ
diff --git a/data/images/creatures/flame/ghostflame-2.png b/data/images/creatures/flame/ghostflame-2.png
new file mode 100644 (file)
index 0000000..99bc839
Binary files /dev/null and b/data/images/creatures/flame/ghostflame-2.png differ
diff --git a/data/images/creatures/flame/ghostflame-3.png b/data/images/creatures/flame/ghostflame-3.png
new file mode 100644 (file)
index 0000000..7a4c763
Binary files /dev/null and b/data/images/creatures/flame/ghostflame-3.png differ
diff --git a/data/images/creatures/flame/ghostflame-4.png b/data/images/creatures/flame/ghostflame-4.png
new file mode 100644 (file)
index 0000000..280cf0b
Binary files /dev/null and b/data/images/creatures/flame/ghostflame-4.png differ
diff --git a/data/images/creatures/flame/ghostflame-editor.png b/data/images/creatures/flame/ghostflame-editor.png
new file mode 100644 (file)
index 0000000..f13234a
Binary files /dev/null and b/data/images/creatures/flame/ghostflame-editor.png differ
diff --git a/data/images/creatures/flame/ghostflame.sprite b/data/images/creatures/flame/ghostflame.sprite
new file mode 100644 (file)
index 0000000..a940ec5
--- /dev/null
@@ -0,0 +1,16 @@
+(supertux-sprite
+ (action
+  (hitbox 0.2 0.2 31.6 31.6)
+  (name "normal")
+  (images "ghostflame-0.png"
+          "ghostflame-1.png"
+          "ghostflame-2.png"
+          "ghostflame-3.png"
+          "ghostflame-4.png"))
+ (action
+  (hitbox 96 96 127.8 31.8)
+  (name "editor")
+  (images "ghostflame-editor.png"))
+
+)
+
diff --git a/data/images/creatures/flame/ghostflame.xcf b/data/images/creatures/flame/ghostflame.xcf
new file mode 100644 (file)
index 0000000..d0662b4
Binary files /dev/null and b/data/images/creatures/flame/ghostflame.xcf differ
diff --git a/data/images/creatures/flame/iceflame-0.png b/data/images/creatures/flame/iceflame-0.png
new file mode 100644 (file)
index 0000000..639e23d
Binary files /dev/null and b/data/images/creatures/flame/iceflame-0.png differ
diff --git a/data/images/creatures/flame/iceflame-1.png b/data/images/creatures/flame/iceflame-1.png
new file mode 100644 (file)
index 0000000..71cda2a
Binary files /dev/null and b/data/images/creatures/flame/iceflame-1.png differ
diff --git a/data/images/creatures/flame/iceflame-2.png b/data/images/creatures/flame/iceflame-2.png
new file mode 100644 (file)
index 0000000..23c0570
Binary files /dev/null and b/data/images/creatures/flame/iceflame-2.png differ
diff --git a/data/images/creatures/flame/iceflame-3.png b/data/images/creatures/flame/iceflame-3.png
new file mode 100644 (file)
index 0000000..c2b185d
Binary files /dev/null and b/data/images/creatures/flame/iceflame-3.png differ
diff --git a/data/images/creatures/flame/iceflame-4.png b/data/images/creatures/flame/iceflame-4.png
new file mode 100644 (file)
index 0000000..2a4243c
Binary files /dev/null and b/data/images/creatures/flame/iceflame-4.png differ
diff --git a/data/images/creatures/flame/iceflame-5.png b/data/images/creatures/flame/iceflame-5.png
new file mode 100644 (file)
index 0000000..4e7a49b
Binary files /dev/null and b/data/images/creatures/flame/iceflame-5.png differ
diff --git a/data/images/creatures/flame/iceflame-editor.png b/data/images/creatures/flame/iceflame-editor.png
new file mode 100644 (file)
index 0000000..24120c0
Binary files /dev/null and b/data/images/creatures/flame/iceflame-editor.png differ
diff --git a/data/images/creatures/flame/iceflame-fade-0.png b/data/images/creatures/flame/iceflame-fade-0.png
new file mode 100644 (file)
index 0000000..0ebf65d
Binary files /dev/null and b/data/images/creatures/flame/iceflame-fade-0.png differ
diff --git a/data/images/creatures/flame/iceflame-fade-1.png b/data/images/creatures/flame/iceflame-fade-1.png
new file mode 100644 (file)
index 0000000..fb1deaa
Binary files /dev/null and b/data/images/creatures/flame/iceflame-fade-1.png differ
diff --git a/data/images/creatures/flame/iceflame-fade-2.png b/data/images/creatures/flame/iceflame-fade-2.png
new file mode 100644 (file)
index 0000000..879d70f
Binary files /dev/null and b/data/images/creatures/flame/iceflame-fade-2.png differ
diff --git a/data/images/creatures/flame/iceflame-fade-3.png b/data/images/creatures/flame/iceflame-fade-3.png
new file mode 100644 (file)
index 0000000..c161dc9
Binary files /dev/null and b/data/images/creatures/flame/iceflame-fade-3.png differ
diff --git a/data/images/creatures/flame/iceflame.sprite b/data/images/creatures/flame/iceflame.sprite
new file mode 100644 (file)
index 0000000..4416d76
--- /dev/null
@@ -0,0 +1,26 @@
+(supertux-sprite
+; these graphics could use some work
+ (action
+  (hitbox 0 0 31.8 31.8)
+  (name "normal")
+  (images "iceflame-0.png"
+          "iceflame-1.png"
+          "iceflame-2.png"
+          "iceflame-3.png"
+          "iceflame-4.png"
+          "iceflame-5.png"))
+ (action
+  (hitbox 0 0 31.8 31.8)
+  (name "fade")
+  (fps 5)
+  (images "iceflame-1.png"
+          "iceflame-fade-0.png"
+          "iceflame-fade-1.png"
+          "iceflame-fade-2.png"
+          "iceflame-fade-3.png"))
+ (action
+  (hitbox 96 96 127.8 31.8)
+  (name "editor")
+  (images "iceflame-editor.png"))
+)
+
diff --git a/data/images/creatures/flame/iceflame.xcf b/data/images/creatures/flame/iceflame.xcf
new file mode 100644 (file)
index 0000000..98a8565
Binary files /dev/null and b/data/images/creatures/flame/iceflame.xcf differ
index 58ac63a..8b3e2c8 100755 (executable)
@@ -16,9 +16,9 @@
                (short_fuse     (x      1152    )(y     736     ))                                                                                                                                                                                                                                                                                              
                (short_fuse     (x      1248    )(y     736     ))                                                                                                                                                                                                                                                                                              
                (haywire        (x      928     )(y     736     ))                                                                                                                                                                                                                                                                                              
-               (flame  (x      1088    )(y     512     ))                                                                                                                                                                                                                                                                                              
-               (flame  (x      1088    )(y     512     ))                                                                                                                                                                                                                                                                                              
-               (flame  (x      1088    )(y     512     ))                                                                                                                                                                                                                                                                                              
+               (flame  (x      576     )(y     480     )(speed 0.2))                                                                                                                                                                                                                                                                                           
+               (iceflame       (x      736     )(y     480     )(speed 0.2))                                                                                                                                                                                                                                                                                           
+               (ghostflame     (x      656     )(y     160     ))                                                                                                                                                                                                                                                                                              
                                                                                                                                                                                                                                                                                                                                                        
                (tilemap        (name   "Interactive"   )                                                                                                                                                                                                                                                                                                               
                        (z-pos  0       )(solid #t      )                                                                                                                                                                                                                                                                                               
index 28cea98..d061f67 100644 (file)
@@ -34,9 +34,9 @@ Flame::Flame(const Reader& reader) :
   angle(0), 
   radius(100), 
   speed(2),
-  fading(true),
+  fading(false),
   light(0.0f,0.0f,0.0f),
-  lightsprite(sprite_manager->create("images/objects/lightmap_light/lightmap_light-tiny.sprite")),
+  lightsprite(sprite_manager->create("images/objects/lightmap_light/lightmap_light-small.sprite")),
   sound_source()
 {
   reader.get("radius", radius);
@@ -77,6 +77,7 @@ Flame::draw(DrawingContext& context)
     if (light.red + light.green < 2.0){
       context.push_target();
       context.set_target(DrawingContext::LIGHTMAP);
+      sprite->draw(context, get_pos(), layer);
       lightsprite->draw(context, get_bbox().get_middle(), 0);
       context.pop_target();
     }
@@ -109,6 +110,7 @@ Flame::kill_fall()
 void
 Flame::freeze()
 {
+  //TODO: get unique death sound
   sound_manager->play("sounds/fizz.wav", get_pos());
   sprite->set_action("fade", 1);
   Vector ppos = bbox.get_middle();
diff --git a/src/badguy/ghostflame.cpp b/src/badguy/ghostflame.cpp
new file mode 100644 (file)
index 0000000..939ea91
--- /dev/null
@@ -0,0 +1,85 @@
+//  SuperTux
+//  Copyright (C) 2006 Matthias Braun <matze@braunis.de>
+//
+//  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/ghostflame.hpp"
+
+#include <math.h>
+
+#include "audio/sound_manager.hpp"
+#include "math/random_generator.hpp"
+#include "sprite/sprite.hpp"
+#include "sprite/sprite_manager.hpp"
+#include "object/sprite_particle.hpp"
+#include "supertux/object_factory.hpp"
+#include "supertux/sector.hpp"
+#include "util/reader.hpp"
+
+Ghostflame::Ghostflame(const Reader& reader) :
+  BadGuy(reader, "images/creatures/flame/ghostflame.sprite", LAYER_FLOATINGOBJECTS), 
+  angle(0), 
+  radius(100), 
+  speed(2),
+  light(0.0f,0.0f,0.0f),
+  lightsprite(sprite_manager->create("images/objects/lightmap_light/lightmap_light-small.sprite"))
+{
+  reader.get("radius", radius);
+  reader.get("speed", speed);
+  bbox.set_pos(Vector(start_position.x + cos(angle) * radius,
+                      start_position.y + sin(angle) * radius));
+  countMe = false;
+  //TODO: get unique death sound
+  sound_manager->preload("sounds/fizz.wav");
+  
+  set_colgroup_active(COLGROUP_TOUCHABLE);
+  
+  lightsprite->set_blend(Blend(GL_SRC_ALPHA, GL_ONE));
+  lightsprite->set_color(Color(0.21f, 0.00f, 0.21f));
+  
+}
+
+void
+Ghostflame::active_update(float elapsed_time)
+{
+  angle = fmodf(angle + elapsed_time * speed, (float) (2*M_PI));
+  Vector newpos(start_position.x + cos(angle) * radius,
+                start_position.y + sin(angle) * radius);
+  movement = newpos - get_pos();
+  
+}
+
+void
+Ghostflame::draw(DrawingContext& context)
+{
+  //Draw the Sprite.
+  sprite->draw(context, get_pos(), LAYER_OBJECTS);
+  //Draw the light if dark
+  context.get_light( get_bbox().get_middle(), &light );
+  if (light.blue + light.red < 2.0){
+    context.push_target();
+    context.set_target(DrawingContext::LIGHTMAP);
+    sprite->draw(context, get_pos(), layer);
+    lightsprite->draw(context, get_bbox().get_middle(), 0);
+    context.pop_target();
+  }
+}
+
+
+void
+Ghostflame::kill_fall()
+{
+}
+
+/* EOF */
diff --git a/src/badguy/ghostflame.hpp b/src/badguy/ghostflame.hpp
new file mode 100644 (file)
index 0000000..8252178
--- /dev/null
@@ -0,0 +1,43 @@
+//  SuperTux
+//  Copyright (C) 2006 Matthias Braun <matze@braunis.de>
+//
+//  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_GHOSTFLAME_HPP
+#define HEADER_SUPERTUX_BADGUY_GHOSTFLAME_HPP
+
+#include "badguy/badguy.hpp"
+
+class Ghostflame : public BadGuy
+{
+public:
+  Ghostflame(const Reader& reader);
+  Ghostflame(const Ghostflame& ghostflame);
+
+  void active_update(float elapsed_time);
+  void draw(DrawingContext& context);
+  void kill_fall();
+
+private:
+  float angle;
+  float radius;
+  float speed;
+  Color light;
+  SpritePtr lightsprite;
+
+};
+
+#endif
+
+/* EOF */
diff --git a/src/badguy/iceflame.cpp b/src/badguy/iceflame.cpp
new file mode 100644 (file)
index 0000000..24c3f99
--- /dev/null
@@ -0,0 +1,108 @@
+//  SuperTux
+//  Copyright (C) 2006 Matthias Braun <matze@braunis.de>
+//
+//  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/iceflame.hpp"
+
+#include <math.h>
+
+#include "audio/sound_manager.hpp"
+#include "math/random_generator.hpp"
+#include "sprite/sprite.hpp"
+#include "sprite/sprite_manager.hpp"
+#include "object/sprite_particle.hpp"
+#include "supertux/object_factory.hpp"
+#include "supertux/sector.hpp"
+#include "util/reader.hpp"
+
+Iceflame::Iceflame(const Reader& reader) :
+  BadGuy(reader, "images/creatures/flame/iceflame.sprite", LAYER_FLOATINGOBJECTS), 
+  angle(0), 
+  radius(100), 
+  speed(2),
+  fading(false),
+  light(0.0f,0.0f,0.0f),
+  lightsprite(sprite_manager->create("images/objects/lightmap_light/lightmap_light-small.sprite"))
+{
+  reader.get("radius", radius);
+  reader.get("speed", speed);
+  bbox.set_pos(Vector(start_position.x + cos(angle) * radius,
+                      start_position.y + sin(angle) * radius));
+  countMe = false;
+  //TODO: get unique death sound
+  sound_manager->preload("sounds/fizz.wav");
+  
+  set_colgroup_active(COLGROUP_TOUCHABLE);
+  
+  lightsprite->set_blend(Blend(GL_SRC_ALPHA, GL_ONE));
+  lightsprite->set_color(Color(0.00f, 0.13f, 0.18f));
+  
+}
+
+void
+Iceflame::active_update(float elapsed_time)
+{
+  angle = fmodf(angle + elapsed_time * speed, (float) (2*M_PI));
+  Vector newpos(start_position.x + cos(angle) * radius,
+                start_position.y + sin(angle) * radius);
+  movement = newpos - get_pos();
+  
+  if(fading)
+    if (sprite->animation_done()) remove_me();
+}
+
+void
+Iceflame::draw(DrawingContext& context)
+{
+  //Draw the Sprite.
+  sprite->draw(context, get_pos(), LAYER_OBJECTS);
+  //Draw the light if dark
+  context.get_light( get_bbox().get_middle(), &light );
+  if (light.blue + light.green < 2.0){
+    context.push_target();
+    context.set_target(DrawingContext::LIGHTMAP);
+    lightsprite->draw(context, get_bbox().get_middle(), 0);
+    context.pop_target();
+  }
+}
+
+
+void
+Iceflame::kill_fall()
+{
+}
+
+void
+Iceflame::ignite()
+{
+  sound_manager->play("sounds/fizz.wav", get_pos());
+  sprite->set_action("fade", 1);
+  Vector ppos = bbox.get_middle();
+  Vector pspeed = Vector(0, -150);
+  Vector paccel = Vector(0,0);
+  Sector::current()->add_object(new SpriteParticle("images/objects/particles/smoke.sprite", "default", ppos, ANCHOR_MIDDLE, pspeed, paccel, LAYER_BACKGROUNDTILES+2));
+  fading = true;
+  
+  // start dead-script
+  run_dead_script();
+}
+
+bool
+Iceflame::is_flammable() const
+{
+  return true;
+}
+
+/* EOF */
diff --git a/src/badguy/iceflame.hpp b/src/badguy/iceflame.hpp
new file mode 100644 (file)
index 0000000..f43f71d
--- /dev/null
@@ -0,0 +1,47 @@
+//  SuperTux
+//  Copyright (C) 2006 Matthias Braun <matze@braunis.de>
+//
+//  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_ICEFLAME_HPP
+#define HEADER_SUPERTUX_BADGUY_ICEFLAME_HPP
+
+#include "badguy/badguy.hpp"
+
+class Iceflame : public BadGuy
+{
+public:
+  Iceflame(const Reader& reader);
+  Iceflame(const Iceflame& iceflame);
+
+  void active_update(float elapsed_time);
+  void draw(DrawingContext& context);
+  void kill_fall();
+
+  void ignite();
+  bool is_flammable() const;
+
+private:
+  float angle;
+  float radius;
+  float speed;
+  bool fading;
+  Color light;
+  SpritePtr lightsprite;
+
+};
+
+#endif
+
+/* EOF */
index a2e76e8..659267c 100644 (file)
@@ -95,6 +95,7 @@ Bullet::draw(DrawingContext& context)
     if (light.red + light.green < 2.0){
       context.push_target();
       context.set_target(DrawingContext::LIGHTMAP);
+      sprite->draw(context, get_pos(), LAYER_OBJECTS);
       lightsprite->draw(context, get_bbox().get_middle(), 0);
       context.pop_target();
     }
index 71c177c..205739b 100644 (file)
 #include "badguy/fish.hpp"
 #include "badguy/flame.hpp"
 #include "badguy/flyingsnowball.hpp"
+#include "badguy/ghostflame.hpp"
 #include "badguy/ghosttree.hpp"
 #include "badguy/haywire.hpp"
+#include "badguy/iceflame.hpp"
 #include "badguy/igel.hpp"
 #include "badguy/jumpy.hpp"
 #include "badguy/kamikazesnowball.hpp"
@@ -186,8 +188,10 @@ ObjectFactory::init_factories()
   add_factory<Fish>("fish");
   add_factory<Flame>("flame");
   add_factory<FlyingSnowBall>("flyingsnowball");
+  add_factory<Ghostflame>("ghostflame");
   add_factory<GhostTree>("ghosttree");
   add_factory<Haywire>("haywire");
+  add_factory<Iceflame>("iceflame");
   add_factory<Igel>("igel");
   add_factory<Jumpy>("jumpy");
   add_factory<KamikazeSnowball>("kamikazesnowball");