/** * \brief Kills the enemy. * * This function is called when the enemy has no more health points. */ void Enemy::kill() { // if the enemy is immobilized, give some money if (rank == RANK_NORMAL && is_immobilized() && !treasure.is_saved()) { // TODO choose random money (can we do this from scripts?) } // stop any movement and disable attacks set_collision_modes(COLLISION_NONE); clear_movement(); invulnerable = true; can_attack = false; can_attack_again_date = 0; dying_animation_started = true; if (hurt_style == HURT_BOSS) { // A boss: create some explosions. exploding = true; nb_explosions = 0; next_explosion_date = System::now() + 2000; } else { // Replace the enemy sprites. clear_sprites(); switch (get_ground_below()) { case GROUND_HOLE: // TODO animation of falling into a hole. Sound::play("jump"); break; case GROUND_DEEP_WATER: // TODO water animation. Sound::play("splash"); break; case GROUND_LAVA: // TODO lava animation. Sound::play("splash"); break; default: create_sprite("enemies/enemy_killed"); Sound::play("enemy_killed"); break; } } // save the enemy state if required if (is_saved()) { get_savegame().set_boolean(savegame_variable, true); } }
void tick_test2(void) { int i; #define START 40 #define DELAY 50 if(looper2 == START) add_word(msg1); if(looper2 == START+DELAY) add_word(msg2); if(looper2 == START+(DELAY*2)) add_word(msg3); if(looper2 == START+(DELAY*3)) add_word(msg4); if(looper2 == START+(DELAY*4)) add_word(msg5); looper2++; for(i=0;i<128;i++) { back[i] = test2_tab[(i+10) + (128 * theta) ]; } if(sprite_ram_mutex == 0) { clear_sprites(); tick_words(); sprite_ram_mutex = 1; } flip_flop^=1; if(flip_flop == 1) { front = dist_map; back = dist_map2; } else { front = dist_map2; back = dist_map; } /* theta++; if(theta == 0) theta = 1; if(theta==0xff) theta = 1; */ }
void tick_spiral(void) { int i; looper++; for(i=0;i<244;i++) { hscroll_buf[(i*2)]= (((cos_tab[((i>>2)+looper)&0xff]*float2fix(40.0f))>>8)>>8)+70; hscroll_buf[(i*2)+1] = 0; } if(sprite_ram_mutex == 0) { clear_sprites(); if((shouts[shouts_pos].pos+START) <= looper) { word(150, shouts[shouts_pos].message); shouts_pos++; } sprite_ram_mutex = 1; } }
MapEntity::~MapEntity() { clear_movement(); clear_old_movements(); clear_sprites(); clear_old_sprites(); }