From: Marek Moeckel Date: Mon, 18 Jul 2005 16:53:20 +0000 (+0000) Subject: added Kugelblitz badguy: basic code, placeholder images and a test level X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=494094f3657ff198da148e1185a628fe0ec26b6c;p=supertux.git added Kugelblitz badguy: basic code, placeholder images and a test level SVN-Revision: 2728 --- diff --git a/data/images/creatures/kugelblitz/falling-0.png b/data/images/creatures/kugelblitz/falling-0.png new file mode 100644 index 000000000..fc41ba2bb Binary files /dev/null and b/data/images/creatures/kugelblitz/falling-0.png differ diff --git a/data/images/creatures/kugelblitz/falling-1.png b/data/images/creatures/kugelblitz/falling-1.png new file mode 100644 index 000000000..459a51508 Binary files /dev/null and b/data/images/creatures/kugelblitz/falling-1.png differ diff --git a/data/images/creatures/kugelblitz/falling-2.png b/data/images/creatures/kugelblitz/falling-2.png new file mode 100644 index 000000000..d727988a2 Binary files /dev/null and b/data/images/creatures/kugelblitz/falling-2.png differ diff --git a/data/images/creatures/kugelblitz/flying-0.png b/data/images/creatures/kugelblitz/flying-0.png new file mode 100644 index 000000000..551ac2b65 Binary files /dev/null and b/data/images/creatures/kugelblitz/flying-0.png differ diff --git a/data/images/creatures/kugelblitz/flying-1.png b/data/images/creatures/kugelblitz/flying-1.png new file mode 100644 index 000000000..8f7ff58d2 Binary files /dev/null and b/data/images/creatures/kugelblitz/flying-1.png differ diff --git a/data/images/creatures/kugelblitz/flying-2.png b/data/images/creatures/kugelblitz/flying-2.png new file mode 100644 index 000000000..99831f8bc Binary files /dev/null and b/data/images/creatures/kugelblitz/flying-2.png differ diff --git a/data/images/sprites.strf b/data/images/sprites.strf index 4321e121a..50bea266c 100644 --- a/data/images/sprites.strf +++ b/data/images/sprites.strf @@ -1315,6 +1315,24 @@ (x-offset 2) (y-offset -19) (mirror-action "squished-left"))) + +; Kugelblitz + (sprite (name "kugelblitz") + (action + (name "falling") + (x-offset 0) + (y-offset ) + (images "creatures/kugelblitz/falling-0.png" + "creatures/kugelblitz/falling-1.png" + "creatures/kugelblitz/falling-2.png")) + (action + (name "flying") + (x-offset 0) + (y-offset 0) + (images "creatures/kugelblitz/flying-0.png" + "creatures/kugelblitz/flying-1.png" + "creatures/kugelblitz/flying-2.png")) + ) ;; Game elements follow diff --git a/data/levels/test/kugelblitz.stl b/data/levels/test/kugelblitz.stl new file mode 100644 index 000000000..f8861b9f4 --- /dev/null +++ b/data/levels/test/kugelblitz.stl @@ -0,0 +1,109 @@ +;; Generated by Flexlay Editor +(supertux-level + (version 2) + (name (_ "Kugelblitz Test")) + (author "Marek") + (sector + (name "main") + (music "ghostforest2.ogg") + (gravity 10.000000) + (tilemap + (layer "background") + (solid #f) + (speed 1.000000) + (width 40) + (height 20) + (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 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 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 + 27 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 28 29 0 0 0 27 28 28 29 + 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 + 76 76 76 76 76 76 76 76 76 76 76 76 76 76 76 76 76 76 76 76 76 76 76 76 76 76 76 76 76 76 76 76 76 76 76 76 76 76 76 76 + 75 75 75 75 75 75 75 75 75 75 75 75 75 75 75 75 75 75 75 75 75 75 75 75 75 75 75 75 75 75 75 75 75 75 75 75 75 75 75 75 + 75 75 75 75 75 75 75 75 75 75 75 75 75 75 75 75 75 75 75 75 75 75 75 75 75 75 75 75 75 75 75 75 75 75 75 75 75 75 75 75 + )) + (tilemap + (layer "foreground") + (solid #f) + (speed 1.000000) + (width 40) + (height 20) + (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 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 + )) + (camera + (mode "normal") + ) + + (background + (image "ghostforest.jpg") + (speed 1.000000) + ) + (poisonivy (x 987) (y 440)) + (poisonivy (x 873) (y 438)) + (kugelblitz (x 519) (y 32)) + (kugelblitz (x 1069) (y 169)) + ) + ) + +;; EOF ;; diff --git a/src/badguy/kugelblitz.cpp b/src/badguy/kugelblitz.cpp new file mode 100644 index 000000000..bab4d32ac --- /dev/null +++ b/src/badguy/kugelblitz.cpp @@ -0,0 +1,97 @@ +// $Id: Kugelblitz.cpp 2654 2005-06-29 14:16:22Z wansti $ +// +// SuperTux +// Copyright (C) 2005 Marek Moeckel +// +// 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 2 +// 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, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +// 02111-1307, USA. +#include + +#include "kugelblitz.hpp" + +static const float JUMPSPEED=600; +static const float Kugelblitz_MID_TOLERANCE=4; +static const float Kugelblitz_LOW_TOLERANCE=2; + +Kugelblitz::Kugelblitz(const lisp::Lisp& reader) + : groundhit_pos_set(false) +{ + reader.get("x", start_position.x); + start_position.y = 0; //place above visible area + bbox.set_size(63.8, 127.8); + sprite = sprite_manager->create("kugelblitz"); + sprite->set_action("falling"); + physic.enable_gravity(false); +} + +void +Kugelblitz::write(lisp::Writer& writer) +{ + writer.start_list("kugelblitz"); + + writer.write_float("x", start_position.x); + writer.write_float("y", start_position.y); + + writer.end_list("kugelblitz"); +} + +void +Kugelblitz::activate() +{ + physic.set_velocity_y(-300); +} + +HitResponse +Kugelblitz::collision_solid(GameObject& , const CollisionHit& chit) +{ + return hit(chit); +} + +HitResponse +Kugelblitz::collision_badguy(BadGuy& other , const CollisionHit& chit) +{ + other.kill_fall(); + return hit(chit); +} + +HitResponse +Kugelblitz::hit(const CollisionHit& chit) +{ + // hit floor? + if(chit.normal.y < -.5) { + if (!groundhit_pos_set) + { + pos_groundhit = get_pos(); + groundhit_pos_set = true; + } + bbox.set_size(63.8, 63.8); + sprite->set_action("flying"); + physic.set_velocity_y(0); + physic.set_velocity_x(100); + + } else if(chit.normal.y < .5) { // bumped on roof + physic.set_velocity_y(0); + } + + return CONTINUE; +} + +void +Kugelblitz::active_update(float elapsed_time) +{ + BadGuy::active_update(elapsed_time); +} + +IMPLEMENT_FACTORY(Kugelblitz, "kugelblitz") diff --git a/src/badguy/kugelblitz.hpp b/src/badguy/kugelblitz.hpp new file mode 100644 index 000000000..9cffb3174 --- /dev/null +++ b/src/badguy/kugelblitz.hpp @@ -0,0 +1,44 @@ +// $Id: jumpy.hpp 2642 2005-06-26 13:38:53Z matzebraun $ +// +// SuperTux +// Copyright (C) 2005 Marek Moeckel +// +// 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 2 +// 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, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +// 02111-1307, USA. +#ifndef __KUGELBLITZ_H__ +#define __KUGELBLITZ_H__ + +#include "badguy.hpp" + +class Kugelblitz : public BadGuy +{ +public: + Kugelblitz(const lisp::Lisp& reader); + + void activate(); + HitResponse collision_solid(GameObject& other, const CollisionHit& hit); + HitResponse collision_badguy(BadGuy& other, const CollisionHit& hit); + + void write(lisp::Writer& writer); + void active_update(float); + +private: + HitResponse hit(const CollisionHit& hit); + Vector pos_groundhit; + bool groundhit_pos_set; +}; + +#endif +