How do I make audio play only once on mouse over condition

Get help using Construct 2

Post » Mon Jun 09, 2014 8:05 am

i dont know if this is a bug, i tried this in several construct2 releases, i want a sound to play only once when the mouse over an sprite, so i add a not looping aduio, however, it still loops until mouse leave the sprite.
what can i do to fix this?
Any help you may offer would be greatly appreciated.
You do not have the required permissions to view the files attached to this post.
B
17
S
5
Posts: 31
Reputation: 1,150

Post » Mon Jun 09, 2014 11:38 am

Try this

Add a global variable name it "Play Once" to compare

use above condition with another

Mouse cursor is over porchicon
Play once is equal to 0 then action play gamebutton
set play once to 1

Hope this helps!
Every Game is a Good Game it's just few people like and few does not! Keep coding people some day you will be a "NOTCH".
B
21
S
6
G
3
Posts: 85
Reputation: 4,607

Post » Mon Jun 09, 2014 12:35 pm

iGamersBox wrote:Try this

Add a global variable name it "Play Once" to compare

use above condition with another

Mouse cursor is over porchicon
Play once is equal to 0 then action play gamebutton
set play once to 1

Hope this helps!


Wow, you are amazing brother! thank you Soooooooooo much, yep, i tried it and it worked!
B
17
S
5
Posts: 31
Reputation: 1,150

Post » Mon Jun 09, 2014 1:11 pm

you can also use audio tags, add a "tag" and check in the event if audio "tag" is not playing.
Image
B
71
S
28
G
12
Posts: 515
Reputation: 12,284

Post » Mon Jun 09, 2014 3:36 pm

Glad to Help you!

Good luck for your game!
Every Game is a Good Game it's just few people like and few does not! Keep coding people some day you will be a "NOTCH".
B
21
S
6
G
3
Posts: 85
Reputation: 4,607

Post » Mon Jun 09, 2014 3:39 pm

There is a also a special condition to do exactly that. It turns a normal event into a triggered event. Check it out in the manual. It's called "Trigger once while true".
B
67
S
27
G
24
Posts: 968
Reputation: 18,571

Post » Tue Jun 10, 2014 12:19 pm

Magistross wrote:There is a also a special condition to do exactly that. It turns a normal event into a triggered event. Check it out in the manual. It's called "Trigger once while true".

Thank you, yes, i need read the manual again, more carefully :)
B
17
S
5
Posts: 31
Reputation: 1,150

Post » Tue Jun 10, 2014 12:20 pm

Lof wrote:you can also use audio tags, add a "tag" and check in the event if audio "tag" is not playing.

Thanks a lot!
B
17
S
5
Posts: 31
Reputation: 1,150

Post » Tue Jun 10, 2014 12:21 pm

iGamersBox wrote:Glad to Help you!

Good luck for your game!

Thank you brother
B
17
S
5
Posts: 31
Reputation: 1,150


Return to How do I....?

Who is online

Users browsing this forum: mrkaio, Zav and 1 guest