The dirHit symbol, located in the dirHit layer of Scene 1 of HUDKit.fla, is the container for the direction hit indicator. dirHit contains eight MovieClips, divided into appropriately named layers: tl, l, bl, b, br, r, tr, and t.
Each of these MovieClips contains an alpha-blended red semi-circle which will be used as an indicator for:
Figure 9: dirHit Symbol
When a player is hit, the hit indicator will appear and then fade-out after ~1 second. The fade-out animation is a Classic Tween alpha-blend on the Flash timeline. By calling GFx::Value::GotoAndPlay(“on”) for any of the hit indicator MovieClips, it will appear and then fade-out over 1 second. The appropriate MovieClip based on the relative direction of the damage’s source.
void FxHUDView::OnEvent( FxHUDEvent* pevent ) { switch ( pevent->GetType() ) { // If the Damage Event (Player was hit) is fired, show the appropriate directional hit indicator. // We can use GotoAndPlay("on") to play the fade-in animation. It will // fade out on its own after ~1 second (this animation is setup on the Flash timeline) case FxHUDEvent::EVT_Damage: { FxHUDDamageEvent* peventDamage = (FxHUDDamageEvent*)pevent; float dir = peventDamage->GetDirection(); if (dir > 0) { if (dir > 90) { if (dir > 135) DirMC_B.GotoAndPlay("on"); else DirMC_BR.GotoAndPlay("on"); } else { if (dir > 45) DirMC_TR.GotoAndPlay("on"); else DirMC_T.GotoAndPlay("on"); } } else { if (dir < -90) { if (dir < -135) DirMC_B.GotoAndPlay("on"); else DirMC_BL.GotoAndPlay("on"); } else { if (dir < -45) DirMC_L.GotoAndPlay("on"); else DirMC_TL.GotoAndPlay("on"); } } break; } }