How to remove variable value, when just a collision

0 favourites
  • 5 posts
From the Asset Store
Easily store, modify, read and manipulate colors with Color Variables!
  • Hello,

    I'm making a game in which the user assembles his plate.

    Every time he puts the food on the plate, add a value to the variable. Until then OK.

    The problem is that when an item retreat of the dish, I can not subtract the same value that was added to the variable.

    I am attaching the code I did.

    Thank you very much

  • "else" does not pick instances and the way you have implemented this else cancels the above sub-condition since it is nested under "on collision" so it will run if the above it is true.

    try using an instance variable to check things

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Able to resolve this problem, but another appeared.

    If you click and release several times into the dish, and it keeps adding points out, subtract the same way.

    Is to create a way to specify that it can only add 1 point?

  • If you want alimentoX to be able to be put in the plate only once, you can use some global variables to check if that alimento has been already put in there.

    For example, alimento1alreadyUsed, than you need to check if this var is false when you drop the alimento over the plate, and then set it to true when adding 1 to proteinas.

    If you have lots of 'alimentos' I recommend using an 1D array or dictionary to keep track of which one has been already used.

  • Thank you all for your help.

    I was able to do what I wanted, using conditions.

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