60

The reason of my sound bug is turned out to be the infinite looping of SFX inside of

if(turn==0) { if((p1e&JOY_A)&&phase==0) { phase=1; damage=1; attack_type=4; } if((p1e&JOY_B)&&phase==0) { phase=1; damage=2; attack_type=5; } if((p1e&JOY_C)&&phase==0) { phase=1; damage=3; attack_type=6; } if(phase==1) { if(x!=195) { aSpriteSetAnim(&demoSpr,1); x++; } if(x==195) { aSpriteSetAnim(&demoSpr,attack_type); //aSpriteSetAnim(&Enemy,4); if(attack_type==4) { send_sound_command(ADPCM_BMARY_ATTACK1); } if(attack_type==5) { send_sound_command(ADPCM_BMARY_ATTACK2); } if(attack_type==6) { send_sound_command(ADPCM_BMARY_ATTACK3); } if(demoSpr.currentAnim==0&&demoSpr.stepNum==0) { enemy_hp-=damage; textTimer=0; fixPrintf1(1,26,3,3,"Enemy lost %d HP.", damage); waitVBlank(); phase=2; } } } if(phase==2) { if(x!=87) { flipMode|=FLIP_X; aSpriteSetFlip(&demoSpr,flipMode); aSpriteSetAnim(&demoSpr,1); x--; } if(x==87) { flipMode&=~FLIP_X; aSpriteSetFlip(&demoSpr,flipMode); aSpriteSetAnim(&demoSpr,0); turn=1; phase=0; if(enemy_hp<=0) { send_sound_command(ADPCM_LOCATION); clearFixLayer(); clearSprites(1,192); SCClose(); waitVBlank(); return; } } } }
condition. I had to add an additional variable which allows to play punch/kick sound when its value is equal to 0 only, and switching to 1 just after first SFX playback, and returning to 0 at next "phase" only.
avatar

61

top

62

The sound of hit getting by enemy is added.
avatar

63