Play roll sound when rolling and bounce sound when bouncing

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
Post Reply
somebodyelse
Prole
Posts: 11
Joined: Thu Feb 13, 2014 4:49 am

Play roll sound when rolling and bounce sound when bouncing

Post by somebodyelse »

How do you know when the Ball is rolling on the ground? I have tried numerous things but they are not accurate. I want to play a bounce sound when the ball bounces, but when it is rolling, I want to play a rolling sound.

I have tried checking current.y == last.y but this doesn't work properly because if you bounce on an angle (not straight up and down) many times the ball will stay on the ground for an unnoticeable amount of time which causes it to play the rolling sound which it shouldn't.
User avatar
Azhukar
Party member
Posts: 478
Joined: Fri Oct 26, 2012 11:54 am

Re: Play roll sound when rolling and bounce sound when bounc

Post by Azhukar »

somebodyelse wrote:How do you know when the Ball is rolling on the ground? I have tried numerous things but they are not accurate. I want to play a bounce sound when the ball bounces, but when it is rolling, I want to play a rolling sound.
For bounce you could determine the impact force and adjust sound accordingly.

Rolling sound could be based on velocity and play only when touching ground.
Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot], Bing [Bot] and 1 guest