--- /dev/null
+(supertux-sprite
+ (action
+ (name "flying-left")
+ (x-offset 3)
+ (y-offset 3)
+ (images "flying.png")
+ )
+ (action
+ (name "flying-right")
+ (x-offset 3)
+ (y-offset 3)
+ (mirror-action "flying-left")
+ )
+ )
--- /dev/null
+(supertux-sprite
+ (action
+ (name "idle-left")
+ (images "idle.png")
+ )
+ (action
+ (name "idle-right")
+ (mirror-action "idle-left")
+ )
+ (action
+ (name "loading-left")
+ (images
+ "idle.png"
+ "loading-0.png"
+ "loading-1.png"
+ "loading-2.png"
+ "loading-3.png"
+ "loading-4.png"
+ )
+ )
+ (action
+ (name "loading-right")
+ (mirror-action "loading-left")
+ )
+ )
--- /dev/null
+;; Generated by Flexlay Editor
+(supertux-level
+ (version 2)
+ (name (_ "DartTrap Test"))
+ (author "Marek")
+ (sector
+ (name "main")
+ (gravity 10.000000)
+ (tilemap
+ (layer "background")
+ (solid #f)
+ (speed 1.000000)
+ (width 30)
+ (height 30)
+ (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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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
+ ))
+ (camera
+ (mode "normal")
+ )
+
+ (background
+ (image "images/background/arctis.jpg")
+ (speed 0.500000)
+ )
+
+ (darttrap (x 800) (y 850))
+ (powerup (x 100) (y 700) (sprite "images/powerups/egg/egg.sprite"))
+ (spawnpoint (name "main") (x 40) (y 700))
+ )
+ )
+
+;; EOF ;;
--- /dev/null
+// $Id: dart.cpp 3327 2006-04-13 15:02:40Z sommer $
+//
+// Dart - Your average poison dart
+// Copyright (C) 2006 Christoph Sommer <supertux@2006.expires.deltadevelopment.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 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 <config.h>
+
+#include "dart.hpp"
+
+namespace {
+ const float SPEED = 200;
+}
+
+Dart::Dart(const lisp::Lisp& reader) : set_direction(false), parent(0)
+{
+ reader.get("x", start_position.x);
+ reader.get("y", start_position.y);
+ bbox.set_size(9, 1);
+ sprite = sprite_manager->create("images/creatures/dart/dart.sprite");
+ physic.enable_gravity(false);
+ countMe = false;
+}
+
+Dart::Dart(float pos_x, float pos_y, Direction d, const BadGuy* parent = 0) : set_direction(true), initial_direction(d), parent(parent)
+{
+ start_position.x = pos_x;
+ start_position.y = pos_y;
+ bbox.set_size(9, 1);
+ sprite = sprite_manager->create("images/creatures/dart/dart.sprite");
+ physic.enable_gravity(false);
+ countMe = false;
+}
+
+void
+Dart::write(lisp::Writer& writer)
+{
+ writer.start_list("dart");
+ writer.write_float("x", start_position.x);
+ writer.write_float("y", start_position.y);
+ writer.end_list("dart");
+}
+
+void
+Dart::activate()
+{
+ if (set_direction) dir = initial_direction;
+ physic.set_velocity_x(dir == LEFT ? -::SPEED : ::SPEED);
+ sprite->set_action(dir == LEFT ? "flying-left" : "flying-right");
+}
+
+void
+Dart::deactivate()
+{
+ remove_me();
+}
+
+HitResponse
+Dart::collision_solid(GameObject& , const CollisionHit& )
+{
+ remove_me();
+ return ABORT_MOVE;
+}
+
+HitResponse
+Dart::collision_badguy(BadGuy& badguy, const CollisionHit& )
+{
+ // ignore collisions with parent
+ if (&badguy == parent) {
+ return FORCE_MOVE;
+ }
+ remove_me();
+ badguy.kill_fall();
+ return ABORT_MOVE;
+}
+
+HitResponse
+Dart::collision_player(Player& player, const CollisionHit& hit)
+{
+ remove_me();
+ return BadGuy::collision_player(player, hit);
+}
+
+
+
+IMPLEMENT_FACTORY(Dart, "dart")
+
--- /dev/null
+// $Id: dart.hpp 3327 2006-04-13 15:02:40Z sommer $
+//
+// Dart - Your average poison dart
+// Copyright (C) 2006 Christoph Sommer <supertux@2006.expires.deltadevelopment.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 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 __DART_H__
+#define __DART_H__
+
+#include "badguy.hpp"
+
+/**
+ * Badguy "Dart" - Your average poison dart
+ */
+class Dart : public BadGuy
+{
+public:
+ Dart(const lisp::Lisp& reader);
+ Dart(float pos_x, float pos_y, Direction d, const BadGuy* parent);
+
+ void activate();
+ void deactivate();
+ void write(lisp::Writer& writer);
+
+ HitResponse collision_solid(GameObject& object, const CollisionHit& hit);
+ HitResponse collision_badguy(BadGuy& badguy, const CollisionHit& hit);
+ HitResponse collision_player(Player& player, const CollisionHit& hit);
+
+protected:
+ bool set_direction;
+ Direction initial_direction;
+ const BadGuy* parent; /**< collisions with this BadGuy will be ignored */
+};
+
+#endif
+
--- /dev/null
+// $Id: darttrap.cpp 3342 2006-04-14 22:48:51Z sommer $
+//
+// DartTrap - Shoots a Dart at regular intervals
+// Copyright (C) 2006 Christoph Sommer <supertux@2006.expires.deltadevelopment.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 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 <config.h>
+
+#include "darttrap.hpp"
+#include "dart.hpp"
+
+namespace {
+ const float MUZZLE_Y = 28; /**< [px] muzzle y-offset from top */
+}
+
+DartTrap::DartTrap(const lisp::Lisp& reader) : initial_delay(0), fire_delay(2), ammo(-1), state(IDLE)
+{
+ reader.get("x", start_position.x);
+ reader.get("y", start_position.y);
+ reader.get("initial-delay", initial_delay);
+ reader.get("fire-delay", fire_delay);
+ reader.get("ammo", ammo);
+ bbox.set_size(11, 37);
+ sprite = sprite_manager->create("images/creatures/darttrap/darttrap.sprite");
+ countMe = false;
+}
+
+void
+DartTrap::write(lisp::Writer& writer)
+{
+ writer.start_list("darttrap");
+ writer.write_float("x", start_position.x);
+ writer.write_float("y", start_position.y);
+ writer.write_float("initial-delay", initial_delay);
+ writer.write_float("fire-delay", fire_delay);
+ writer.write_int("ammo", ammo);
+ writer.end_list("darttrap");
+}
+
+void
+DartTrap::activate()
+{
+ if (set_direction) dir = initial_direction;
+ state = IDLE;
+ sprite->set_action(dir == LEFT ? "idle-left" : "idle-right");
+
+ if (initial_delay == 0) initial_delay = 0.1;
+ fire_timer.start(initial_delay);
+}
+
+HitResponse
+DartTrap::collision_player(Player& , const CollisionHit& )
+{
+ return ABORT_MOVE;
+}
+
+void
+DartTrap::active_update(float )
+{
+ if (state == IDLE) {
+ if ((ammo != 0) && (fire_timer.check())) {
+ if (ammo > 0) ammo--;
+ load();
+ fire_timer.start(fire_delay);
+ }
+ }
+ if (state == LOADING) {
+ if (sprite->animation_done()) {
+ fire();
+ }
+ }
+}
+
+void
+DartTrap::load()
+{
+ state = LOADING;
+ sprite->set_action(dir == LEFT ? "loading-left" : "loading-right", 1);
+}
+
+void
+DartTrap::fire()
+{
+ float px = get_pos().x;
+ if (dir == RIGHT) px += 5;
+ float py = get_pos().y;
+ py += MUZZLE_Y;
+
+ Sector::current()->add_object(new Dart(px, py, dir, this));
+ state = IDLE;
+ sprite->set_action(dir == LEFT ? "idle-left" : "idle-right");
+}
+
+IMPLEMENT_FACTORY(DartTrap, "darttrap")
+
--- /dev/null
+// $Id: darttrap.hpp 3327 2006-04-13 15:02:40Z sommer $
+//
+// DartTrap - Shoots a Dart at regular intervals
+// Copyright (C) 2006 Christoph Sommer <supertux@2006.expires.deltadevelopment.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 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 __DARTTRAP_H__
+#define __DARTTRAP_H__
+
+#include "badguy.hpp"
+#include "timer.hpp"
+
+/**
+ * Badguy "DartTrap" - Shoots a Dart at regular intervals
+ */
+class DartTrap : public BadGuy
+{
+public:
+ DartTrap(const lisp::Lisp& reader);
+
+ void activate();
+ void write(lisp::Writer& writer);
+ void active_update(float elapsed_time);
+ HitResponse collision_player(Player& player, const CollisionHit& hit);
+
+protected:
+ enum State {
+ IDLE, LOADING
+ };
+
+ void load(); /**< load a shot */
+ void fire(); /**< fire a shot */
+
+ bool set_direction;
+ Direction initial_direction;
+ float initial_delay; /**< time to wait before firing first shot */
+ float fire_delay; /**< reload time */
+ int ammo; /**< ammo left (-1 means unlimited) */
+
+ State state; /**< current state */
+ Timer fire_timer; /**< time until new shot is fired */
+};
+
+#endif
+