How do I evaluate an object clicked?

  • I have 10 different balls all randomly moving around on the screen.

    I would like to display the name of a ball (from an array, hopefully, but I'm not sure how to read in array and do that either) and have the user click on the ball whose name is displayed. Then, I need to evaluate the mouse click - did the user click the right ball (give a success sound and blow up the ball) or not (bad sound).

    Right now all the balls are instances of one graphic. I can't see how I can evaluate the mouse click to determine whether or not the user has clicked the right ball. The mouse click event only accepts the graphic 'ball', not the instances. I know I can add a custom variable to each ball instance, but I don't see how (with the mouse click) to evaluate whether it is the right one that has been clicked or not. This is probably fairly easy to do (once you know how!).

    Any tips on how to do this?

    Thanks

    Ron

  • -instance variable "name"

    -global variable "varName"

    compare :"name"="varName".......

    example.capx

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Thanks korbaach!

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)