How to make a sound when slashing at any angle?

Dell7730Dell7730 Member, PRO Posts: 388
edited April 2015 in Working with GS (PC)

How would you make a rule that if you move an object ay any angle and goes more than 5 velocity, you play sound?

Best Answer

  • RThurmanRThurman Posts: 2,880
    Accepted Answer

    You could use the magnatidue function. Like this:
    magnitude( self.Motion.Linear Velocity.X , self.Motion.Linear Velocity.Y )

    Here is a quick demo that changes color (not sound).

Answers

  • Dell7730Dell7730 Member, PRO Posts: 388

    thanks, i'll try that tonight

  • Dell7730Dell7730 Member, PRO Posts: 388

    @RThurman said:
    You could use the magnatidue function. Like this:
    magnitude( self.Motion.Linear Velocity.X , self.Motion.Linear Velocity.Y )

    Here is a quick demo that changes color (not sound).

    for some reason the link of the sample file is not showing up anymore, can you please provide the link again? thanks.

  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949

    The forums software has a bug that removes attached files when a post is marked as "Answered." Lovely, huh? :s

    You can notify another user like this: @RThurman

    New to GameSalad? (FAQs)   |   Tutorials   |   Templates   |   Greenleaf Games   |   Educator & Certified GameSalad User

  • Dell7730Dell7730 Member, PRO Posts: 388

    @tatiang said:
    The forums software has a bug that removes attached files when a post is marked as "Answered." Lovely, huh? :s

    You can notify another user like this: RThurman

    still waiting for that sample file, lol

  • RThurmanRThurman Member, Sous Chef, PRO Posts: 2,880

    Second try:

  • Dell7730Dell7730 Member, PRO Posts: 388

    @RThurman said:
    Second try:

    Awesome! Thanks Very Much

  • Dell7730Dell7730 Member, PRO Posts: 388

    @RThurman

    your demo, it works but only if your mouse starts from the middle of the actor, how can I make it work outside of the actor anywhere on the screen?

  • RThurmanRThurman Member, Sous Chef, PRO Posts: 2,880

    @Dell Agarpo said:
    RThurman

    your demo, it works but only if your mouse starts from the middle of the actor, how can I make it work outside of the actor anywhere on the screen?

    Hmm..... it works on any place on the screen on a Mac. Is this a PC problem?
    But beyond that, it only was meant to demonstrate how to determine the speed of an actor. (Not how to do a swipe.) You can get the actor to move in all sorts of ways and the "speed detection" will still work.

  • Dell7730Dell7730 Member, PRO Posts: 388
    edited April 2015

    @RThurman said:
    But beyond that, it only was meant to demonstrate how to determine the speed of an actor. (Not how to do a swipe.) You can get the actor to move in all sorts of ways and the "speed detection" will still work.

    Yeah, it would seem like there's a lot of things that don't work on pc version, lol... let me try it on my phone and let you know if it works and thank you again

  • RThurmanRThurman Member, Sous Chef, PRO Posts: 2,880

    You are welcome!

Sign In or Register to comment.