354 |
Window() : Stone("st-window"), state(IDLE) {} |
Window() : Stone("st-window"), state(IDLE) {} |
355 |
private: |
private: |
356 |
bool on_laserhit(Direction /*dir*/) { return true; } |
bool on_laserhit(Direction /*dir*/) { return true; } |
357 |
enum State { IDLE, BREAK }; |
enum State { IDLE, BREAK } state; |
|
State state; |
|
358 |
void actor_hit(const StoneContact &sc) |
void actor_hit(const StoneContact &sc) |
359 |
{ |
{ |
360 |
Actor *a = sc.actor; |
Actor *a = sc.actor; |
361 |
if( state == IDLE) |
if (state == IDLE) |
362 |
{ |
{ |
363 |
if (a->get_vel() * sc.normal < -25 ) { |
if (a->get_vel() * sc.normal < -25 ) { |
364 |
play_sound("shatter"); |
play_sound("shatter"); |
411 |
State state; |
State state; |
412 |
|
|
413 |
void break_me() { |
void break_me() { |
414 |
play_sound("explosion1"); |
if (state == IDLE) { |
415 |
state = BREAK; |
state = BREAK; |
416 |
set_anim("st-stone_break-anim"); |
play_sound("explosion1"); |
417 |
|
set_anim("st-stone_break-anim"); |
418 |
|
} |
419 |
} |
} |
420 |
|
|
421 |
void actor_hit(const StoneContact &sc) |
void actor_hit(const StoneContact &sc) { |
422 |
{ |
if (wielded_item_is(sc.actor, "it-hammer")) |
|
if( state == IDLE && wielded_item_is(sc.actor, "it-hammer")) { |
|
423 |
break_me(); |
break_me(); |
|
} |
|
424 |
} |
} |
425 |
bool on_laserhit(Direction) { |
bool on_laserhit(Direction) { |
426 |
break_me(); |
break_me(); |
427 |
return false; |
return false; |
428 |
} |
} |
429 |
void animcb() { |
void animcb() { KillStone(get_pos()); } |
|
if (state == BREAK) { |
|
|
KillStone(get_pos()); |
|
|
} |
|
|
} |
|
430 |
}; |
}; |
431 |
|
|
432 |
} |
} |