tags:

views:

26

answers:

0

Can anyone provide me codes for putting a sound during collision detection? Here is my code for collision detection

self.navigationItem.leftBarButtonItem = nil;
float distance_Ob1 = sqrt ((Devil.center.x - Object.center.x)*(Devil.center.x - Object.center.x)  +
         (Devil.center.y - Object.center.y)*(Devil.center.y - Object.center.y) 
         );

if(distance_Ob1 < 35)
{
    hit = hit + 1;
    hitlabel.text = [NSString stringWithFormat:@"%i" , hit];
    deviceTilt.y = FALSE;
    Object.center = CGPointMake(170,365);
    speed = 0;
    position.y = speed;
    Devil.hidden = YES;
    bang.hidden = NO;
}