4 // Copyright (C) 2005 Matthias Braun <matze@braunis.de>
6 // This program is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU General Public License
8 // as published by the Free Software Foundation; either version 2
9 // of the License, or (at your option) any later version.
11 // This program is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 // GNU General Public License for more details.
16 // You should have received a copy of the GNU General Public License
17 // along with this program; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
24 Spike::Spike(const Vector& pos, Direction dir)
26 sprite = sprite_manager->create("spike");
28 bbox.set_pos(Vector(0, 0));
29 bbox.set_size(32, 32);
34 Spike::Spike(const lisp::Lisp& reader)
36 sprite = sprite_manager->create("spike");
37 reader.get("x", start_position.x);
38 reader.get("y", start_position.y);
39 bbox.set_size(32, 32);
41 reader.get("direction", idir);
42 set_direction((Direction) idir);
47 Spike::set_direction(Direction dir)
52 sprite->set_action("north");
55 sprite->set_action("south");
58 sprite->set_action("west");
61 sprite->set_action("east");
69 Spike::write(lisp::Writer& writer)
71 writer.start_list("spike");
72 writer.write_float("x", start_position.x);
73 writer.write_float("y", start_position.y);
74 writer.write_int("direction", spikedir);
75 writer.end_list("spike");
81 // you can't kill a spike
85 Spike::active_update(float )
89 IMPLEMENT_FACTORY(Spike, "spike")