5 Flame::Flame(const lisp::Lisp& reader)
6 : angle(0), radius(100), speed(2)
8 reader.get("x", start_position.x);
9 reader.get("y", start_position.y);
10 reader.get("radius", radius);
11 reader.get("speed", speed);
12 bbox.set_pos(Vector(start_position.x + cos(angle) * radius,
13 start_position.y + sin(angle) * radius));
14 bbox.set_size(32, 32);
15 sprite = sprite_manager->create("flame");
19 Flame::write(lisp::Writer& writer)
21 writer.start_list("flame");
23 writer.write_float("x", start_position.x);
24 writer.write_float("y", start_position.y);
25 writer.write_float("radius", radius);
26 writer.write_float("speed", speed);
28 writer.end_list("flame");
32 Flame::active_action(float elapsed_time)
34 angle = fmodf(angle + elapsed_time * speed, 2*M_PI);
35 Vector newpos(start_position.x + cos(angle) * radius,
36 start_position.y + sin(angle) * radius);
37 movement = newpos - get_pos();