1// SuperTux badguy - Iceflame a flame-like enemy that can be killed with fireballs
2// Copyright (C) 2013 LMH <lmh.0013@gmail.com>
3//
4// This program is free software: you can redistribute it and/or modify
5// it under the terms of the GNU General Public License as published by
6// the Free Software Foundation, either version 3 of the License, or
7// (at your option) any later version.
8//
9// This program is distributed in the hope that it will be useful,
10// but WITHOUT ANY WARRANTY; without even the implied warranty of
11// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12// GNU General Public License for more details.
13//
14// You should have received a copy of the GNU General Public License
15// along with this program. If not, see <http://www.gnu.org/licenses/>.
16
17#include "badguy/iceflame.hpp"
18
19#include <math.h>
20
21#include "audio/sound_manager.hpp"
22#include "audio/sound_source.hpp"
23#include "math/util.hpp"
24#include "object/sprite_particle.hpp"
25#include "sprite/sprite.hpp"
26#include "sprite/sprite_manager.hpp"
27#include "supertux/sector.hpp"
28
29Iceflame::Iceflame(const ReaderMapping& reader) :
30 Flame(reader)
31{
32 m_lightsprite->set_color(Color(0.00f, 0.13f, 0.18f));
33 m_sprite = SpriteManager::current()->create("images/creatures/flame/iceflame.sprite");
34}
35
36void
37Iceflame::active_update(float dt_sec)
38{
39 Flame::active_update(dt_sec);
40 m_sprite->set_angle(math::degrees(angle) * 3.0f);
41}
42
43void
44Iceflame::ignite()
45{
46 SoundManager::current()->play("sounds/sizzle.ogg", get_pos());
47 m_sprite->set_action("fade", 1);
48 Sector::get().add<SpriteParticle>("images/objects/particles/smoke.sprite",
49 "default",
50 m_col.m_bbox.get_middle(), ANCHOR_MIDDLE,
51 Vector(0, -150), Vector(0,0),
52 LAYER_BACKGROUNDTILES+2);
53 set_group(COLGROUP_DISABLED);
54
55 // start dead-script
56 run_dead_script();
57}
58
59bool
60Iceflame::is_flammable() const
61{
62 return true;
63}
64
65bool
66Iceflame::is_freezable() const
67{
68 return false;
69}
70
71/* EOF */
72