static void move( pos next_pos ) { pos monster_pos = get_monster_pos(); next_pos.on = is_monster_shited() ? BLOCK : get_( next_pos.row, next_pos.column ); char body = MONSTER; if ( is_monster_catched() ) { body = DEAD; hero_dead(); } play_monstro(); move_to( monster_pos, next_pos, body ); if ( is_monster_shited() ) { play_wet(); usleep( 1000000 ); veiudo.shited = 0; } set_monster_pos( next_pos ); }
void* handle_monster( void *a ) { usleep( WAIT ); while ( !is_hero_dead() ) { pos gallego_pos = get_hero_pos(), monster_pos = get_monster_pos(), next_pos = get_monster_pos(); maybe_monster_wants_stop(); search_hero( _monster_moviment_default, &gallego_pos, &monster_pos, &next_pos ); if ( gallego_pos.row == next_pos.row && gallego_pos.column == next_pos.column ) monster_catched(); if ( get_( next_pos.row, next_pos.column ) == BOSTA ) { score_up(); pisou_na_bosta(); veiudo.shited_sec = get_sec(); } if ( get_( next_pos.row, next_pos.column ) == TRAP ) { veiudo.wet_sec = get_sec(); veiudo.wet = 1; // vou por som de pisar no molhado que ficará na função move...junto com o monster.wav //if ( !get_rand( 15 ) ) // play_wet(); } // if ( get_sec() - veiudo.shited_sec == 2 || get_sec() - veiudo.shited_sec == -58 ) // veiudo.shited = 0; // a ser colocado no set.c! if ( get_sec() - veiudo.wet_sec == 2 || get_sec() - veiudo.wet_sec == -58 ) veiudo.wet = 0; move( next_pos ); usleep( DELAY ); } return NULL; }
pair<int,int> board::which_peat_missed() { if(get_numberOfPeat()<40) return get_monster_pos(); }