@@ -39,21 +39,22 @@ static const float SUCK_TARGET_SPREAD = 8;
39
39
40
40
GhostTree::GhostTree (const ReaderMapping& mapping) :
41
41
Boss(mapping, " images/creatures/ghosttree/ghosttree.sprite" , LAYER_OBJECTS - 10 ),
42
- mystate(STATE_IDLE),
43
- willowisp_timer(),
42
+ m_state(STATE_IDLE),
43
+ m_attack(ATTACK_RED),
44
+ /* willowisp_timer(),
44
45
willo_spawn_y(0),
45
46
willo_radius(200),
46
47
willo_speed(1.8f),
47
- willo_color(0 ),
48
- glow_sprite(SpriteManager::current()->create(" images/creatures/ghosttree/ghosttree-glow.sprite" )),
49
- colorchange_timer(),
48
+ willo_color(0),*/
49
+ // glow_sprite(SpriteManager::current()->create("images/creatures/ghosttree/ghosttree-glow.sprite")),
50
+ /* colorchange_timer(),
50
51
suck_timer(),
51
52
root_timer(),
52
53
treecolor(0),
53
54
suck_lantern_color(),
54
55
m_taking_life(),
55
- suck_lantern(nullptr ),
56
- willowisps ()
56
+ suck_lantern(nullptr),*/
57
+ m_willowisps ()
57
58
{
58
59
mapping.get (" hud-icon" , m_hud_icon, " images/creatures/ghosttree/hudlife.png" );
59
60
m_hud_head = Surface::from_file (m_hud_icon);
@@ -66,8 +67,8 @@ GhostTree::GhostTree(const ReaderMapping& mapping) :
66
67
void
67
68
GhostTree::die ()
68
69
{
69
-
70
- for (const auto & willo : willowisps) {
70
+ // TODO
71
+ /* for (const auto& willo : willowisps) {
71
72
willo->vanish();
72
73
}
73
74
@@ -76,22 +77,44 @@ GhostTree::die()
76
77
set_action("dying", 1);
77
78
glow_sprite->set_action("dying", 1);
78
79
run_dead_script();
79
- }
80
+ }*/
80
81
}
81
82
82
83
void
83
84
GhostTree::activate ()
84
85
{
85
- willowisp_timer.start (1 .0f , true );
86
+ /* willowisp_timer.start(1.0f, true);
86
87
colorchange_timer.start(13, true);
87
- root_timer.start (5 , true );
88
+ root_timer.start(5, true);*/
88
89
}
89
90
90
91
void
91
92
GhostTree::active_update (float dt_sec)
92
93
{
93
94
Boss::boss_update (dt_sec);
94
-
95
+ switch (m_state) {
96
+ case STATE_INIT:
97
+ // TODO
98
+ break ;
99
+ case STATE_SCREAM:
100
+ // TODO
101
+ break ;
102
+ case STATE_IDLE:
103
+ // TODO
104
+ break ;
105
+ case STATE_SUCKING:
106
+ // TODO
107
+ break ;
108
+ case STATE_ATTACKING:
109
+ // TODO
110
+ break ;
111
+ case STATE_DEAD:
112
+ // TODO
113
+ break ;
114
+ default :
115
+ break ;
116
+ }
117
+ /*
95
118
if (mystate == STATE_IDLE) {
96
119
m_taking_life = false;
97
120
if (colorchange_timer.check()) {
@@ -164,15 +187,6 @@ GhostTree::active_update(float dt_sec)
164
187
}
165
188
}
166
189
167
- // TODO: Add support for the new root implementation
168
- /*
169
- if (root_timer.check()) {
170
- //TODO: indicate root with an animation.
171
- auto player = get_nearest_player();
172
- if (player)
173
- Sector::get().add<Root>(Vector(player->get_bbox().get_left(), (m_flip == NO_FLIP ? (m_col.m_bbox.get_bottom() + ROOT_TOP_OFFSET) : (m_col.m_bbox.get_top() - ROOT_TOP_OFFSET - ROOT_HEIGHT))), m_flip);
174
- }
175
- */
176
190
} else if (mystate == STATE_SWALLOWING) {
177
191
if (suck_lantern) {
178
192
// Suck in the lantern.
@@ -205,31 +219,35 @@ GhostTree::active_update(float dt_sec)
205
219
}
206
220
}
207
221
}
208
- }
222
+ }*/
209
223
}
210
224
211
- bool
225
+ void GhostTree::set_state (MyState new_state) {
226
+
227
+ }
228
+
229
+ /* bool
212
230
GhostTree::is_color_deadly(Color color) const
213
231
{
214
232
if (color == Color(0,0,0)) return false;
215
233
Color my_color = glow_sprite->get_color();
216
234
return ((my_color.red != color.red) || (my_color.green != color.green) || (my_color.blue != color.blue));
217
- }
235
+ }*/
218
236
219
237
void
220
238
GhostTree::willowisp_died (TreeWillOWisp* willowisp)
221
239
{
222
- if ((mystate == STATE_SUCKING) && (willowisp->was_sucked )) {
223
- mystate = STATE_IDLE ;
240
+ if ((m_state == STATE_SUCKING) && (willowisp->was_sucked )) {
241
+ m_state = STATE_ATTACKING ;
224
242
}
225
- willowisps .erase (std::find_if (willowisps .begin (), willowisps .end (),
226
- [willowisp](const GameObject* lhs)
227
- {
228
- return lhs == willowisp;
229
- }));
243
+ m_willowisps .erase (std::find_if (m_willowisps .begin (), m_willowisps .end (),
244
+ [willowisp](const GameObject* lhs)
245
+ {
246
+ return lhs == willowisp;
247
+ }));
230
248
}
231
249
232
- void
250
+ /* void
233
251
GhostTree::draw(DrawingContext& context)
234
252
{
235
253
Boss::draw(context);
@@ -242,23 +260,24 @@ GhostTree::draw(DrawingContext& context)
242
260
}
243
261
glow_sprite->draw(context.light(), get_pos(), m_layer);
244
262
context.pop_transform();
245
- }
263
+ }*/
246
264
247
265
bool
248
266
GhostTree::collides (MovingObject& other, const CollisionHit& ) const
249
267
{
250
- if (mystate != STATE_SUCKING ) return false ;
251
- if (dynamic_cast <Lantern*>(&other)) return true ;
268
+ if (m_state != STATE_RECHARGING ) return false ;
269
+ // if (dynamic_cast<Lantern*>(&other)) return true;
252
270
if (dynamic_cast <Player*>(&other)) return true ;
253
271
return false ;
254
272
}
255
273
256
274
HitResponse
257
275
GhostTree::collision (MovingObject& other, const CollisionHit& )
258
276
{
259
- if (mystate != STATE_SUCKING ) return ABORT_MOVE;
277
+ if (m_state != STATE_RECHARGING ) return ABORT_MOVE;
260
278
261
- auto player = dynamic_cast <Player*>(&other);
279
+ // TODO collision from above? subtract one life
280
+ /* auto player = dynamic_cast<Player*>(&other);
262
281
if (player) {
263
282
player->kill(false);
264
283
}
@@ -269,16 +288,16 @@ GhostTree::collision(MovingObject& other, const CollisionHit& )
269
288
suck_lantern->grab(*this, suck_lantern->get_pos(), Direction::RIGHT);
270
289
suck_lantern_color = lantern->get_color();
271
290
mystate = STATE_SWALLOWING;
272
- }
291
+ }*/
273
292
274
293
return ABORT_MOVE;
275
294
}
276
295
277
- void
296
+ /* void
278
297
GhostTree::spawn_lantern()
279
298
{
280
299
Sector::get().add<Lantern>(m_col.m_bbox.get_middle() + SUCK_TARGET_OFFSET);
281
- }
300
+ }*/
282
301
283
302
std::vector<Direction>
284
303
GhostTree::get_allowed_directions () const
0 commit comments