Basic Banking System Part 4/4

After you’ve done the Withdraw steps, Deposit works in similar ways with some key differences.

First, use a Show Text command for the bank teller to ask something along the lines of “How much would you like to deposit?\$” In this situation, the \$ code will display how much money you are currently carrying in a separate window.

Follow this question with an Input Number command. Choose how many digits you would like to have and that you would like to store the number into the Deposit variable. For my game, I will use 7 digits for a minimum of 0000000 or a maximum of 9999999 Gold.

bank010

Next, just like with our Withdraw step, we need a Conditional Branch to check how much we want to deposit against how much we are actually carrying.

Inside the Conditional Branch, set it to Variable and for your first variable, choose your Gold variable. Change the mathematical symbol to the ≥ (greater than or equal to) and set your second variable to Deposit. Finally, before you hit OK, check the Create Else Branch box.

bank011.png

As we did for the Withdraw step, let’s fill in what happens in the Else condition first. Use a Show Text command to alert the player they are trying to put more into the bank than they are carrying by having your bank teller say something similar to “I’m afraid you do not have that much money at the moment.” Follow this Show Text command with a Control Variables command. Set it for your Deposit variable and leave the Operation at Set and leave the Operand at a Constant of 0. Finally, place a Jump to Label command that returns us to reset.

With the Else condition out of the way, let’s find out what happens in the If: Gold ≥ Deposit condition. Inside that part of the Conditional Branch, we need to first add the money to our Account variable. Insert a Control Variables command and set the variable to Account. Change the Operation to Add and set the Operand to your Deposit variable.

bank012

Next, let’s remove the amount you are depositing from the Gold you are carrying with a Change Gold command. In this, choose decrease and set it to your Deposit variable.

bank013

Next, let’s have our bank teller alert the player that the transaction was successful by using a Show Text. Have them say something like “Your account has been debited \v[9]. You now have \v[7] in your account. Thank you!” Remember, my variable #9 is my Deposit variable. My variable #7 is my Account variable.

After the show text, let’s zero out our Deposit variable so the number we entered previously doesn’t show up again the next time we want to deposit money into our account. Simply add a Control Variables command and set it to your Deposit variable. It already has the Operation on Set and the Operand at a Constant of 0, so we just need to click OK.

Finally, put in a Jump to Label command that returns us to reset.

Our bank is now functional!

Give it a try! The full code is at the end of the page for your reference.

Of course, this is the basic bank system. There’s quite a bit we can do with what we have here, but that’s for future tutorials. One thing we can do at this point is fill in our Information choice to inform the player of how the bank works. I’ll leave that up to you, since you’ve just made one! Or if you really want, you can take a peek at the full code to see what I’ve put in.

bank016

Prevpage button

 

 

 

 

*Please note that no tutorial may be copied or reproduced without the expressed written authorization of PODS Game Design. Any use of these tutorials to create a system(s) or function(s) in any game must be properly credited. Please contact PODS Game Design at podsgamedesign@gmail.com for further information.*