How do I add a value on an Instance Variable

  • Hey!

    Actually the question it's a little more complicated than simple adding a value.

    What im trying to do is, when I click on an instance of an object, if it meets the conditions to do it. Add a value to a variable from another instance from another object. If I try to add the value to a Global Variable it ends up adding it. If I try another condition (i.e.: Every X seconds) it adds the value to the object variable.

    What am I doing wrong?

    Cheers!

    P.D.: Here's a Link http://imgur.com/uyNUSJs where you can see the action that I'm trying to work.

  • I guess the title might be a little loose u-u

  • So if I get this correctly you are trying to take the value of an Instance variable for treasure and put it into your players Instance variable?

    Make sure that you do the Math's before you destroy the Treasure Object. So have the Treasure Destroy event further down.

  • Actually do try the inverse, instead of "Player is overlapping treasure" -> "Treasure is overlapping player".

    Same for "ActiveTile", since you have on top of your condition one instance of "Treasure" which is picked, being the one you touched on.

    This is THIS instance that helps deciding the other conditions and picking the appropriate tile.

    The order of the destroy action does not impact there since the treasure instance will only be destroyed on the next tick no matter what.

    The issue there is mainly the picking of the "ActiveTile" instance I think.

  • Okay guys, I'll try those solutions when I get home and tell you how it went! Thanks for the feedback!

  • Neither of those solutions worked guys :c

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • HOORAAAAAY! I did it!

    The solution was to delete the Treasure overlaping Player, since only one tile can have the active state it wasnt necesary to have that condition. I tried disabling it and now it works c:

    Thanks for your responses!

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