How do I select "if not"?

0 favourites
  • 6 posts
From the Asset Store
2D fighting template based in the game that defined the fighting games genre.
  • Hi, sorry for my english , im french xD

    I have a question:

    I have a multiple instances of an object "banana" , and banana is on family "Food"

    When LMB is pressed and mouse is on Food, the variable "selected" of Food change to "true" so its change the variable of banana where mouse is on.

    When Food selected is true -> Make Food.xy on Mouse.xy

    How can i said this : If 1 Food is already selected then its not possible to select an other Food?

    Because currently, if i select an banana and i moove with it on another banana, it select it too -> 2 Food are "selected"

    Thanks a lot!

  • Easiest would probably be to just use a second variable to track if a food is currently picked. So in the event where you select food with LMB you compare if this variable is false and then to true. When you drop the object again set the variable back to false.

    FYI: There is also a Drag & Drop behavior that might just do all of that out of the box. Not sure if it works for your project.

    construct.net/en/make-games/manuals/construct-3/behavior-reference/drag-drop

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • ..or you can simply change your two conditions:

    Mouse button is down

    Mouse is on Object (Food)

    to just one:

    On Object Clicked (Food)

    This way, even if cursor goes over another banana, it won't get selected, because now, only "On Clicked" will pick a food.

  • True but he could still select multiple fruits that way

  • On FOOD clicked

    -> Pick all Food

    ----> Set Food "Selected" to false

    -> Pick random instance of Food

    ---->Set Selected to True

    this way all the foods are deselected, and then the new food is selected. Also, If there is more than 1 food being clicked, only 1 food will be randomly picked from the pile and selected

  • And for info you can have the "is not" when you RMB on your condition : the X invert

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