playMaker

Author Topic: Shot[SOLVED]  (Read 8303 times)

Dev_Sebas

  • 1.2 Beta
  • Sr. Member
  • *
  • Posts: 398
    • Blog
Shot[SOLVED]
« on: August 26, 2011, 03:23:39 PM »
Hi I have a small problem
I have 2 states
1 with a mouse down
and another with a mouse up and with a play sound
When I press mouse I listened the sound but if I will be pressing the sound finish. this is only a shot. I need loop.
How can I make it?
Please help
Thanks
« Last Edit: January 31, 2012, 04:25:24 PM by Sebastiao »

Alex Chouls

  • Administrator
  • Hero Member
  • *****
  • Posts: 4000
  • Official Playmaker Support
    • LinkedIn
Re: Shot
« Reply #1 on: August 26, 2011, 04:38:17 PM »
You could add an AudioComponent to the GameObject and use Audio actions (e.g., AudioPlay, AudioStop). This will give you more control over how the audio plays.

Dev_Sebas

  • 1.2 Beta
  • Sr. Member
  • *
  • Posts: 398
    • Blog
Re: Shot
« Reply #2 on: August 26, 2011, 04:51:39 PM »
Thanks Alex I will try
Bye

Dev_Sebas

  • 1.2 Beta
  • Sr. Member
  • *
  • Posts: 398
    • Blog
Re: Shot
« Reply #3 on: August 26, 2011, 05:05:21 PM »
It is not good too
Any help
Bye

Damian

  • 1.2 Beta
  • Full Member
  • *
  • Posts: 188
    • Permaximum Betty
Re: Shot
« Reply #4 on: August 26, 2011, 07:24:56 PM »
You only need to set the sound to loop.
Then just play it and it will play the loop so long you dont turn it of or change the sound.

Dev_Sebas

  • 1.2 Beta
  • Sr. Member
  • *
  • Posts: 398
    • Blog
Re: Shot
« Reply #5 on: August 26, 2011, 08:50:18 PM »
Yes I try but if I up in middle of sound it don´t finish.
Bye

Dev_Sebas

  • 1.2 Beta
  • Sr. Member
  • *
  • Posts: 398
    • Blog
Re: Shot
« Reply #6 on: August 28, 2011, 11:44:33 AM »
Please give me some help...
Bye

Alex Chouls

  • Administrator
  • Hero Member
  • *****
  • Posts: 4000
  • Official Playmaker Support
    • LinkedIn
Re: Shot
« Reply #7 on: August 28, 2011, 03:29:37 PM »
If you need the sound to stop on mouse up I would suggest taking another look at the Audio Actions: Audio Play and Audio Stop.

Have you tried adding an AudioComponent to your GameObject and using the Audio actions?

What happens? Does the sound play?

Can you post what you tried?

Dev_Sebas

  • 1.2 Beta
  • Sr. Member
  • *
  • Posts: 398
    • Blog
Re: Shot
« Reply #8 on: August 28, 2011, 04:08:32 PM »
1-No I don´t need the sound stop on mouse up
2-Yes I have tried
3-I press and sound but if I up the sound does not finish (it´s cut)
4-Yes it plays
5-I have a som of BootCamps rifle and I want when I press play sound and when I up stop sound.
Hope you understand
Bye
Please help me

qholmes

  • 1.2 Beta
  • Hero Member
  • *
  • Posts: 509
Re: Shot
« Reply #9 on: August 29, 2011, 01:16:15 PM »
So as a guess you want it to repeat when the mouse it down but when the mouse is up then you want it to finish the current loop but then stop??

Q

Dev_Sebas

  • 1.2 Beta
  • Sr. Member
  • *
  • Posts: 398
    • Blog
Re: Shot
« Reply #10 on: August 29, 2011, 04:42:09 PM »
Hi qholmes
I need this.
1 I press five seconds and play a sound per second. When I up the current sound continues playing until the end.
Is like a game.
If you help will be much appreciated.
Bye

qholmes

  • 1.2 Beta
  • Hero Member
  • *
  • Posts: 509
Re: Shot
« Reply #11 on: August 29, 2011, 05:12:04 PM »
Yes that is what i meant by what i wrote i think..

Well i tried a simple loop using an Audio Play to play the sound.. It gives you the Finished Event sot hat you can go back to check and see if your mouse button is still pressed.. It worked but only twice then it hung up in the Audio Play State for some reason... I have no idea why.

My mouse button check state was just a Get Mouse Button and set a Bool to the value then do a Bool Test and the True Event was the Audio Play State..

But like i said it seemed to hang... Maybe it did not like to be called so quickly or something... Could put in a tiny delay there between the mouse button check and the call..

Not sure that helps but that was my quick test.. I am sure there are other ways of doing it..

Q

qholmes

  • 1.2 Beta
  • Hero Member
  • *
  • Posts: 509
Re: Shot
« Reply #12 on: August 29, 2011, 05:21:39 PM »
Ok had a new thought....

Start event.. Get Mouse Button Down. It triggers An Audio Play and a Set Audio Loop to On Then a Send event to go to the next State

That state Checks for Get Mouse Button UP.. Which triggers to the next state that Sets the Audio Loop to Off and returns to the Start State.. 4 States and it loop pretty good.. Stays looping while the button is down and finishes last iteration when button is up and stops.

Hope that helps

Q

Dev_Sebas

  • 1.2 Beta
  • Sr. Member
  • *
  • Posts: 398
    • Blog
Re: Shot
« Reply #13 on: August 29, 2011, 06:09:47 PM »
Hi qholmes
Can you explain a little better I can not understand very well
Bye


qholmes

  • 1.2 Beta
  • Hero Member
  • *
  • Posts: 509
Re: Shot
« Reply #14 on: August 29, 2011, 07:08:13 PM »
Hehh ok in a bit

Q