How do I subtract 1?

0 favourites
  • 6 posts
From the Asset Store
Aliens are invading our planet! Solve the math question, and attack the alien with your laser. Covers addition, subtract
  • C3/Mobile Game

    This is driving me nut - it worked perfectly in another game I made and it won't work now.

    It will not subtract 1 from slot3Need.

    I assume that I have put the wrong variable in the wrong spot but I've been looking at this for so long it's now just a jumble.

    Everything else finally works, but it won't subtract 1 from slot3Need.

    When I shoot the fruit, it adds 1 to slot3Hit each time and when I reach 3, it sets slot3Hit back to 0, but it doesn't take 1 from slot3Need.

    (I hope this is one of those times when I click submit and I find it in 2 seconds.)

  • slot3need variable is reset to 5 on every tick in "Level 1" group. Even if you subtract 1 from it, the next tick it will become 5 again.

  • dop2000,

    I don't understand.

    The text is set for every tick, but that sets the text to show what slot3Need is. It doesn't set the variable every tick.

    What am I missing?

    What is really aggravating is that I set it up like this in another game and it works perfectly.

    This is the other game:

  • This is the event I was talking about, it resets the variable to 5 on every tick (while level=1)

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • dop2000,

    Ohhhhhhh! I didn't know it worked like that (and I'm confused as to how/why it works in the other game.)

    So now the question becomes how to set a different variable, for each fruit, for each level? On level 1 the player only needs to destroy 5 bananas, but on level 12 the player may need to destroy 12 bananas.

    Well, that's my project for today.

    Thanks for the information.

  • dop2000,

    OH I SEE why it works in the other game, I am using 3 different variables instead of just 2 and the first variable has to stay constant. DUH!

    Thanks again.

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