How to make 1 actor recognize another actor?
Bluemoonstudios
Member Posts: 156
Hey everyone, I am having a problem and I am hoping you can help me. I have made a spinning wheel, and it has 16 different colours on it. I also have an arrow actor. At the moment i have the wheel spinning and the arrow just stays still. What I am having trouble with is when the wheel stops spinning I want the arrow to recognize what colour it is on and then play a sound depending on the colour. I hope that makes sense. I suppose you could think of it like wheel of fortune. If i had numbers and then when the arrow stops on a number, how does it know what number it is on? Any help would be much appreciated. Thank you.
Comments
360° in a circle, 16 colours, so each colour will occupy 22.5°.
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User
Ok, as simple as I can . . . . .
1) Your wheel rotates.
2) When it's finished rotating it will be at an angle.
3) The angle will correspond to a colour.
4) Er . . . . that's it !
Not sure what else I can add to that, it's such a simple concept . . . . imagine a clock face, now place an arrow (outside the clock) pointing at 3 o'clock, now spin the clock face (the whole clock, not just the hands), when it finishes spinning (let's assume a clockwise spin) you can take a look at its angle, let's say the angle it comes to rest at is 180°, so from that you can tell the arrow is pointing at 9 o'clock . . . . or if it comes to rest at 90° then the arrow is pointing at 12 O'clock . . . . or if it comes to rest at 240° then the arrow is pointing at 7 o'clock . . . etc etc.
Make sense ?
Click on the wheel to spin it.
It will spin to a random position.
Its final angle is displayed on the right.
If you know what angle it is, you know what colour it has landed on.
So make up 16 rules saying . .
If the angle is between 0 and 22.5 degrees then display "You got RED!!!"
If the angle is between 22.5 and 41 degrees then display "You got BLUE!!!"
If the angle is between 41 and 63.5 degrees then display "You got PINK!!!"
Etc etc . . .
New to GameSalad? (FAQs) | Tutorials | Templates | Greenleaf Games | Educator & Certified GameSalad User
:-*