I want to detect the speed at which a ball hits a wall in order to play a different sound depending on the speed it hits. So for instance if it hits the wall hard/fast then i want a sound to be played. But if the ball hits the wall at a slow speed then i want a different sound to be played. For movement the ball uses the accelerometer.
Can this be done? 😕
I'm using the BoxMan class, so i suppose it would be something like:
Can this be done? 😕
I'm using the BoxMan class, so i suppose it would be something like:
Code:
var w:Wall = e.other.m_userData as Wall;
if(w) {
//code here to detect speed at which the ball hits the wall.
var snd:PlaySound = new PlaySound(); //this part plays the sound
snd.play();
}
if(w) {
//code here to detect speed at which the ball hits the wall.
var snd:PlaySound = new PlaySound(); //this part plays the sound
snd.play();
}