Detecting collisions & playing sounds

collision

#1

Hi there,

I would like to have an element play a sound when it collides with another element.
Does anyone have a suggestion how to achieve this(preferably with an example)

Thanks in advance


(Mark Hunte) #2

It may be worth you looking at this thread.

And adding your sound when the collision is detected using the techniques in the thread.


Move an element or div with arrow keys
Action on object hover
(Mark Hunte) #3

Here is a quick example using @fqantonio António pinball Bucket.

This only seems to work twice as I have done it ( Maybe @fqantonio António can answer that ) but it may give you an idea of the way forward…

pinball_bucketAndSound.hype.zip (266.7 KB)


(Nick ) #4

Awesome!! I love it!
Pretty soon we will have the built in Game engine. :smile:


#5

Many Thanks for the suggestions.


(António) #6

Sorry, it was not my pinball game, I didn’t make it, I just found it. Best, António


(Nick ) #7

That is why the files are here. I actually created the art and @h_classen added the original script.
One of the nice things about the forums is we have lots of bits and pieces for people to start making their own creations or make better creations from the templates.

My favorite saying is…
“Stop Learning, START THINKING, and Make Something Creative!”

Basically put… take the pieces and apply what you have already learned to make something new and exciting.

Your ability to add the sound is a great addition for the group.
So Thanks again @fqantonio!! :smile: