How do I subtract money from text?

Get help using Construct 2

Post » Tue Mar 22, 2016 1:40 am

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. :D :D :D :D :D :D
B
3
Posts: 2
Reputation: 179

Post » Tue Mar 22, 2016 1:51 am

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:
Player.Money

Image
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.
Zelda Gamekit (my project)



Example capxs:

Zelda-Style Inventory

Zelda Health

3-saveslot system

[url=https://www.dropbox.com/s/d4396pwak0oh7q6/ZeldaDialogueSystem.capx?dl=0]Zelda-like Dialogue[
B
52
S
24
G
30
Posts: 537
Reputation: 19,651

Post » Wed Mar 23, 2016 4:13 am

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.
B
3
Posts: 2
Reputation: 179

Post » Wed Mar 23, 2016 4:16 am

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.
Zelda Gamekit (my project)



Example capxs:

Zelda-Style Inventory

Zelda Health

3-saveslot system

[url=https://www.dropbox.com/s/d4396pwak0oh7q6/ZeldaDialogueSystem.capx?dl=0]Zelda-like Dialogue[
B
52
S
24
G
30
Posts: 537
Reputation: 19,651

Post » Wed Mar 23, 2016 4:22 am

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
Zelda Gamekit (my project)



Example capxs:

Zelda-Style Inventory

Zelda Health

3-saveslot system

[url=https://www.dropbox.com/s/d4396pwak0oh7q6/ZeldaDialogueSystem.capx?dl=0]Zelda-like Dialogue[
B
52
S
24
G
30
Posts: 537
Reputation: 19,651


Return to How do I....?

Who is online

Users browsing this forum: BiffanyPFH and 30 guests