How to make 1 actor recognize another actor?

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

  • SocksSocks London, UK.Member Posts: 12,822
    When the wheels stops it will be at a certain angle, this angle will correspond with a colour, simply use the angle to 'recognise' the colour.

    360° in a circle, 16 colours, so each colour will occupy 22.5°.


  • BluemoonstudiosBluemoonstudios Member Posts: 156
    Thank you @Socks for your reply but I don't quite understand. I have 1 image of a wheel that is split into 16 different colours like a pizza. So how do I give each piece an angle for the arrow to recognise the colour it is on? Could you please try and explain it a little more for me? Thank you for your help
  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949
    He means that you would have a rule such as When self.rotation >=0 AND self.rotation <=22.5, change attribute game.selectedColor to blue [assuming blue is at that point on your color wheel.

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

  • SocksSocks London, UK.Member Posts: 12,822
    edited October 2013
    . . . how do I give each piece an angle for the arrow to recognise the colour . . . .
    I haven't got a clue what "give each piece an angle" means ? 8-X :(( :)

    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 ?
  • SocksSocks London, UK.Member Posts: 12,822
    edited October 2013
    Very quick demo . . . (attached)



    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 . . .




  • SocksSocks London, UK.Member Posts: 12,822
    He means that you would have a rule such as When self.rotation >=0 AND self.rotation <=22.5, change attribute game.selectedColor to blue [assuming blue is at that point on your color wheel.</blockquote>

    Yep ! This ! :)
  • BluemoonstudiosBluemoonstudios Member Posts: 156
    Thank you so much @Socks and @tatiang that makes sense now. Sorry for not getting it the first time. And thanks heaps for the demo. I'll try it out as soon as I get home. Thanks again guys
  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949
    Quick, @Socks, make me a Wheel of Fortune app! Your demos are always so visually enticing.

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

  • harrywatsonharrywatson Member Posts: 61
    Thanks @socks, another thing I won't have to code in the future.

    :-*
  • BluemoonstudiosBluemoonstudios Member Posts: 156
    Everything is working perfectly!! Thanks again for your help @Socks
Sign In or Register to comment.