Last minute iPad stuff - possible to detect actor rotated position?
guru-at-zidware
Member Posts: 369
....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
Rule
When self.Rotation = [whatever degree you're targeting]
Play Sound
Is that what you were looking for?
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
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
If you update the project on the web I'll take a quick look at it.
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