How do I subtract money from text?

0 favourites
  • 5 posts
From the Asset Store
Change delay, create new lines, "backspace" the text
  • So, I'm trying to make a drag and drop game where when you click on a block, it subtracts money from you account (text box on top left). I'm really confused and would like some assistance. Thx.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Have some sort of variable first, either an instance variable (for the player?) or a global variable if you want more control/less possible bugs. Create a text object, and put it on a layer above the other layers (you know, the layers you have for objects, the player, backgrounds, etc), and set the parallax and scale rate for this new layer to 0.

    On any event that you want to make changes to the player's available money, do your general stuff (subtracting/adding from the variable) but include an event for the text object created, and select the action to change said text's content. Set it the variable. Just type in your variable name (if global) or if using an Instance variable:

    [quote:27cp75iz]Player.Money

    Player is the name of the object that has the instance variable, and Money is the name of said instance variable, which has to be a number type and not boolean or string.

    Another way to go about setting the text is instead including an "Every tick" event at the very top (after any On start of layout events), and in said event, change the text object to the variable.

  • No, what I mean is that when I click on something, and move it out of a certain area, it deducts money from your account. You have $100,000. You take it out of the store, it deducts $20.

  • You're missing the point of part of what I said. See the first action in the picture I showed, where I highlighted the two actions. Just store the money to a global variable, and then use the subtract/add variable actions in the System tab. Still, I provided the picture above in case you didn't know how to display the value of their account to a text object, as you were slightly unclear to begin with.

  • Regardless, I'll whip up a capx of what you need in a moment, almost done with it. Edit: Done.

    https://dl.dropboxusercontent.com/u/589 ... uying.capx

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