Last minute iPad stuff - possible to detect actor rotated position?

guru-at-zidwareguru-at-zidware Member Posts: 369
edited November -1 in Working with GS (Mac)
....just trying to get a lat minute feature going for an iPad game....I have a round actor and want to detect it's rotation....and play a sound a different sound depending where the actor is in degrees?...just a nutty idea....thanks!

Comments

  • firemaplegamesfiremaplegames Member Posts: 3,211
    you have access to the Actor's Rotation. You could create a Rule in the Actor, like this:

    Rule
    When self.Rotation = [whatever degree you're targeting]
    Play Sound

    Is that what you were looking for?
  • guru-at-zidwareguru-at-zidware Member Posts: 369
    yes...kinda.....

    if actor @ 90...then play soundA when tapped...
    if actor @ 180...then play soundB when tapped...

    I made a little demo but it is silent! How do you share files
    on GS....I can post? John
  • firemaplegamesfiremaplegames Member Posts: 3,211
    Ok, no problem.

    You just need to have some Rules in place. Also, since you are smoothly rotating the Actor and not snapping to the different positions, you should also account for a wider degree of possible positions:

    i.e, the chances of a player tapping on the actor when the Actor is at EXACTLY 180 degrees is pretty difficult. A better way would be to check if the Actor is between 175 and 185 degrees to trigger the sound.

    The Rules would be set up like this in the rotating Actor:

    Rule
    When Touch is Pressed
    -----Rule (All)
    -----When self.Rotation > 85
    -----When self.Rotation < 95
    ----------Play Sound A
    -----Rule (All)
    -----When self.Rotation > 175
    -----When self.Rotation < 185
    ----------Play Sound B

    Does that make sense?
    Hope this helps!

    Joe
  • guru-at-zidwareguru-at-zidware Member Posts: 369
    thanks....kinda works but the sound only plays once....so if I do 2 revolutions it does not play the second time?
  • firemaplegamesfiremaplegames Member Posts: 3,211
    that's weird. I'm not sure why that would be happening.

    If you update the project on the web I'll take a quick look at it.
  • guru-at-zidwareguru-at-zidware Member Posts: 369
    hi.....it's up....appreciate the help.....fun to find quirky stuff...!! John
  • firemaplegamesfiremaplegames Member Posts: 3,211
    Hey John!

    Yes, that is definitely a bug. The Rotation is not resetting to 0 after it hits 360. It just keeps on climbing. I'll notify the programmers.

    Also, in your disc actor, you have 3 Rules. You should remove the "When Touch is Pressed" condition from the bottom two Rules. You don't need it.

    To fix the Rotation issue, create another Rule:

    Rule
    When self.Rotation > 360
    Change Attribute self.Rotation To: 0
  • guru-at-zidwareguru-at-zidware Member Posts: 369
    Found a bug cool.....yes the extra did the trick!
Sign In or Register to comment.