How do I prevent other red pieces from being selected?

0 favourites
  • 5 posts
From the Asset Store
80 pieces of loopable game music, 10 game overs and 10 level complete pieces.
  • I'm trying to get my mouse to distinguish between a selected checker piece, while preventing any other pieces to be clicked and marked as "selected". In my event, I have the piece Boolean variable named "IsSelected" to be marked as true when it's clicked on. So I know a piece is selected when it's highlighted (take a look at the pic below). How do I also prevent or disable other pieces from being marked or counted as "selected" from the mouse on click condition?

  • You could set IsSelected to false for the remaining pieces, for example with a ForEach loop, or you could store the UID or IID to a variable instead.

  • You could set IsSelected to false for the remaining pieces, for example with a ForEach loop

    Can you elaborate on this a bit more? Im not understanding how it will get the mouse to not select other pieces.

    A few screenshots of both method you mentioned.

  • For the first method, you need to loop through all instances and set their instance variables to false before setting the current one's instance variable to true. You should use subevents, not separate events, so that things happen in the correct order.

    The second method should not use an instance variable at all, but a local variable. On clicking any CheckerPiece_Red, you should set a local variable (defined ahead of time) to that instance's UID or IID. This way you don't need to deselect any previous pieces, as there can only be one active piece.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Very well explained. I have a clear understanding of the methods of how I might go about with them. Thank you for the clarity. The second method would be the best option to go for.

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